API for adding new sign types
SollyW opened this issue ยท 9 comments
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 MakeEDIT: See #684BlockEntityType.Builder.blocks
not finalInject intoBlockEntityType.Builder
ctor and replace the ImmutableSet with a HashSetAdd an accessor toBlockEntityType.blocks
and use it to add my sign and wall sign
One third-party solution is to use Terraform's API to add sign types.
Implemented in #2585.
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.
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.
An API for the latter 2 points would be reasonable I think. The rest seems a bit too specific.
Conversation about this on fabric discord https://discordapp.com/channels/507304429255393322/566276937035546624/720848910977073244
This seems fairly reasonable to go into fabric API IMO.
I would go about it by making a FabricSignTypeBuilder and a FabricSignType.
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)
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.