FabricMC / fabric

Essential hooks for modding with Fabric.
Apache License 2.0
2.2k stars 388 forks source link

[Suggestion] Add `c:farmlands` #3840

Open dayofpi opened 3 weeks ago

dayofpi commented 3 weeks ago

It's common to want to add a custom farmland block to a mod, this tag would make having modded plants compatible with modded farmland simpler, especially if Fabric automatically changes vanilla crops to accept the tag.

gniftygnome commented 3 weeks ago

Having c:farmlands would be nice. I was just missing it yesterday.

especially if Fabric automatically changes vanilla crops to accept the tag

This bit seems unlikely to me, particularly since there are a surprisingly large number of mixins required. However, you can use Terraform API for it (or to see examples of relatively compatible versions of the mixins).

dayofpi commented 3 weeks ago

Didn't know Terraform included something for farmland, thank you

TelepathicGrunt commented 2 weeks ago

especially if Fabric automatically changes vanilla crops to accept the tag

Just FYI, Neo has a PR in works that changes the vanilla behavior to point to neoforge:villager_farmlands block tag because it is a significant behavior change. I would think if Fabric does the same, they would do it under the Fabric namespace. It seems like it would be 3 mixins to support Farmlands tags in Fabric

https://github.com/neoforged/NeoForge/pull/971/files

From there, mods with custom plants that do want to support modded farmlands could check the modloader tag

TelepathicGrunt commented 1 day ago

So in Neoforge, we realized that using tags for farmland checks within vanilla code could cause desyncs if a vanilla client connects to the server with a modified tag. So we opted for changing the .is(Items.Farmland) checks in vanilla to be instanceof FarmBlock instead so people can make their farmlands extend FarmBlock and work out of the box. This may be more ideal for Fabric to do as well since the tag desync can be an issue