Fabric API

Fabric API

111M Downloads

Remove tag replacement check api

liach opened this issue ยท 5 comments

commented

To revert #63.

This pr has no real value and causes problems with custom Tag implementations, as seen in CaffeineMC/lithium-fabric#33

The fact that a tag has been replaced offers no actual insight; we shouldn't make an assumption on it, especially given that all data packs can be unloaded, i.e. your tag's default elements may be absent even if the tag isn't replaced but your mod data pack is just not loaded.

Yes, I blame asie again. #63 in essence is even less relevant to the api compared to #562, and its merge I'd argue was a total fault.

For proper compatibility and removal, fabric should have added removal support such that a tag can remove elements with certain ids/incertain other tags.

commented

Inapplicable for 1.18.2+

commented

I think it was added before Tag<T> was an interface, so it wasn't really a problem back then.

commented

MixinTagBuilder.java#L46 is missing an instanceof check here.

commented

The fact that a tag has been replaced offers no actual insight

It's not meant for modded tags, no! It's specifically meant for the situation in which Fabric API overrides, say, a hardcoded block type if-check in vanilla, as we cannot know if another mod, Fabric or non-Fabric, hasn't overridden it. The alternatives are:

  • ignore the vanilla if-check, and potentially any mod patches to it,
  • also do the vanilla if-check ("OR" relation), meaning you can not remove blocks/items from the list.

In the vision of Fabric API as minimally intrusive, and in the codebase I worked in when designing this, the solution was perfectly sensible for me, and I recall seeking input about it from other developers - though my memory is famously terrible, so I might be wrong on that last bit. However, I do think that everything should be questioned (otherwise Fabric wouldn't exist at all!) and if codebase circumstances changed (by, f.e., Mojang removing most hardcoded checks out into tags themselves, or by the implementation of Tag becoming less conductive to this), this should be rethought.

Remember - snapshots are the time to do breaking changes in Fabric! Don't worry about snapshot mods and snapshot packs - they will disappear in weeks and perish. Only worry about the stability of release versions.

commented

I think that lithium bug was actually a fabric api bug that I introduced when updating