neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.05k stars 135 forks source link

Remove Forge Milk #1050

Open CodexAdrian opened 1 month ago

CodexAdrian commented 1 month ago

MinecraftForge introduced the milk liquid and some accompanying things with it. It set a standard that all milk in forge mods should use forge's provided milk and nothing else. While there is nothing wrong per se about Forge's milk implementation, its presence is overall harmful to the modded community. The presence of forge added content in general prevents any mod author from being able to express the same idea in their own creative and unique way. The addition of milk has also set a dangerous precedent in the community where users now want more commonly used liquids to be added to forge directly (like honey and experience). This would prevent authors like TelepathicGrunt from expressing his honey liquid in a cool and unique way with how slowly his liquid flows in the world, or prevent the thermal or tinkers team from representing liquid experience in their cool ways with their textures and concepts. Mod developers should be aided by the existence of forge api, not limited in what content they can produce with it. The existence of forge provided content does just that, and it should be established that forge won't add new content and ideally remove the bit of content it has added.

Minecraftschurli commented 1 month ago

Counter argument if 2 mods add a milk fluid which should be used for the milk bucket and how should that be done or are you suggesting that the mods add their own milk buckets and then there are 3 milk buckets with only 2 fluids?

TelepathicGrunt commented 1 month ago

Note: if the motion to remove milk fluid happens, please add test mods and documentation site examples for how to register a milk fluid and read/use it in the most inter-mod-compatible way. I.e. using fluid tags, reading fluid caps, etc. By providing exactly how to do fluids properly in inter-compat ways, it'll encourage good practice that will spread to other kinds of fluids without neo having to provide other kinds of fluids

CodexAdrian commented 1 month ago

Counter argument if 2 mods add a milk fluid which should be used for the milk bucket and how should that be done or are you suggesting that the mods add their own milk buckets and then there are 3 milk buckets with only 2 fluids?

(just gonna copy what i said from neocord instead of retyping)

image
KnightMiner commented 1 month ago

Counter argument if 2 mods add a milk fluid which should be used for the milk bucket and how should that be done or are you suggesting that the mods add their own milk buckets and then there are 3 milk buckets with only 2 fluids?

This is already the case for bowls (various mod soup fluids), honey (honey bottles), potions (potion bottles) and alike. Mods can register the capability themselves easily enough, Forge has supported that since the milk fluid was originally added.

KnightMiner commented 1 month ago

For my more full response to this issue, couple of things worth mentioning.

Why does Forge/Neo have milk?

In 1.12 and earlier, fluids had no namespace; if two mods registered a fluid named milk, Forge would choose one of them as the "default fluid" and the other would be ignored. By 1.15, Mojang added in a fluid registry so now fluids were namespaced, meaning if two mods registered milk, you'd end up with 2 fluids, which are no longer equivalent. Forge badly ported the old milk behavior (see MinecraftForge/MinecraftForge#6769), which in half the places only worked if someone registered minecraft:milk and in half the places were hardcoded to making milk not allowed to have a fluid at all.

Given Forge's capability system allows registering a capability to an existing object as long as that object does not already expose the capability, the best solution to the above would have been Forge just deleting all code related to milk and letting mods handle it (which is what I attempted to do in MinecraftForge/MinecraftForge#6795). However, this fix was refused by the forge team, with them instead requesting an over-engineered solution of Forge conditionally registering a milk fluid if any mod requests it (see MinecraftForge/MinecraftForge#7294).

Why is this a problem?

When I was adding milk to Forge, I was forced to make quite a few choices. The most notable choice was that milk is not placable as a fluid, along with the choice of its texture (still and flowing) and the choice of various fluid attributes such as sounds. At the time apart from placing this was mostly cosmetics. However, with the fluid API rework in 1.19 there were quite a few more behaviors that were restricted (one modder I talked to notably stated they had to register their own fluid type just to allow swimming in their custom placable milk fluid).

What are the benefits of Forge/Neo milk?

The primary benefit is unification, you can guarantee which fluid will be considered "inside" the bucket. However, quite a few other vanilla containers have this same issue without Forge trying to unify them, most notably powdered snow but also things such as honey, soup, and potions. We can easily make fluids equivalent in recipes via common tags (which mods are already doing for all the aforementioned fluids), and you can easily add a fluid capability to a vanilla item (Tinkers notably does this with powdered snow, the first mod adding the handler just wins, not an issue).

The main thing more difficult to do with tags is "outputs", that is if I want to support other mods adding milk but do not have a need to provide it myself, it becomes difficult to select a proper milk fluid from the tag.

What is the solution?

I still believe its better to have Neo provide no fluids rather than trying to add a fluid for every vanilla thing that might be a fluid (thereby removing options from modders). So to start Neo should just remove all assumptions about milk being a fluid, let modders handle it themselves.

To handle the "tag output" problem, I have a solution in Mantle that is worth considering in Neo: tag preferences. Essentially, my config has a list of preferred mod IDs for tag based outputs which can be set by the modpack maker, and the API uses that as a comparator to select the entry from a tag with the most preferred mod ID; or the one alphabetically first if no option is on the list. Such a system could be added to Neo, both for recipes wishing to output milk (or other common fluids) without providing it themselves, and for the fluid capability on the milk bucket. This would allow better support for common fluids without Neo having to decide fluid properties for them all.

Other notes

My fluids that I add to vanilla items typically use my mod's UnplacableFluid class, which is just a fluid with an optional bucket but no block or flowing form. It might be worth adding such a class to Forge to reduce some of the impl needed for fluids that cannot be placed in world.