Fabric API

Fabric API

106M Downloads

API for adding new sign types

SollyW opened this issue ยท 9 comments

commented

The vanilla game is not very open to new types of signs being added. However, doing so is something quite a few mods will want to do, so it should be added to fapi.

I've added a single new sign to the game using vanilla systems. Terraform also does something similar. Here's what I had to do:

  • Add an invoker to SignType.register() and use it to add my SignType
  • Inject into TexturedRenderLayers.getSignTextureId() to add the namespace to the texture path
  • Make BlockEntityType.Builder.blocks not final EDIT: See #684
  • Inject into BlockEntityType.Builder ctor and replace the ImmutableSet with a HashSet
  • Add an accessor to BlockEntityType.blocks and use it to add my sign and wall sign
commented

One third-party solution is to use Terraform's API to add sign types.

commented

Implemented in #2585.

commented

Imho, this seems out of the scope of Fabric API. The goal of Fabric API is not the be the behemoth that some other modding frameworks are, but simply near the bare minimum necessary to develop on the platform and allow mods to play nice with one another. The fact that multiple mods can already add sign types without a conflict and that there are libraries like Terraform available for the job indicate that it is not necessary for Fabric API to have such an api.

commented

Multiple mods can do it, however, it isn't pretty nor is it simple. It's worth mentioning that the last three mixins allow adding blocks to vanilla blockentities, which isn't specific to signs.

commented

An API for the latter 2 points would be reasonable I think. The rest seems a bit too specific.

commented

This seems fairly reasonable to go into fabric API IMO.

I would go about it by making a FabricSignTypeBuilder and a FabricSignType.

commented

Would probably be a FabricSignFactory tbf since it is one param.

The biggest conflict I could see is the ModifyArg you'd probably like to do in order to have the game render the texture corresponding to your sign type. (which fabric api could definitely handle)

commented

Discussion a while ago in discord led to the conclusion that the existing sign block entity is not extensible enough to handle this. Player's suggestion was to whip up a your own sign.

Fabric API may look into a generic sign access interface for these types of modded signs, the shape of that API will need further discussion.