Skip to content

[1.16] Optionally add milk as a fluid to the vanilla bucket#7294

Merged
cpw merged 1 commit into
MinecraftForge:1.16.xfrom
KnightMiner:1.16-add-forge-milk
Jan 17, 2021
Merged

[1.16] Optionally add milk as a fluid to the vanilla bucket#7294
cpw merged 1 commit into
MinecraftForge:1.16.xfrom
KnightMiner:1.16-add-forge-milk

Conversation

@KnightMiner
Copy link
Copy Markdown
Contributor

@KnightMiner KnightMiner commented Sep 1, 2020

This pull request supersedes #6840, in order to fix #6769. After discussion on Discord, it was determined the best solution for mods to add milk as a fluid was for Forge to register the fluid, while mods just set a Forge flag to enable it, similar to the universal bucket back in 1.12

To enable Forge adding milk, you simply need to call ForgeMod.enableMilkFluid() during mod construction. We can move this function to a different location if there is a better one, but this location kept the logic behind the flag clean.

A few details on implementation:

  • It was suggested on Discord that we use minecraft:milk and alike rather than the forge namespace for the fluids.
  • A tag forge:milk was added containing the still and flowing milk like the vanilla water and lava tags. I am not sure if we want to add the tag to the minecraft namespace instead for consistency with the fluid's namespace, but I know some mods are using forge:milk for compat right now so it probably is better to stick with that.
  • No fluid block is included to prevent the need for Forge to change the behavior of the vanilla bucket. I could add one that is simply unused by default if preferred.
  • I had to add a listener to the texture stitch event to ensure fluid textures are registered (KingLemming can give more details on why that is required). I am not sure if there is a better place than a client event listener subclass of ForgeMod, but I can say it does not cause issues when launching a server there.
  • I did a bit of cleanup regarding milk in the bucket wrapper logic as the checks for milk are redundant to the fallback. The water and lava checks there really are redundant as well, but as they are just field lookups instead of object creation and are unrelated to this PR, I left them as is.

Included in this PR is ForgeMilkTest that will enable the Forge milk fluid and cause a milk bucket to display the name of the contained fluid on right click. You can enable the test mod using the boolean ENABLE flag.

Finally, credits to Rorax for the textures for the milk fluid. Used for this PR with permission.

@KnightMiner
Copy link
Copy Markdown
Contributor Author

Updated to resolve conflicts with be58851

@KnightMiner
Copy link
Copy Markdown
Contributor Author

Updated to resolve conflicts with c75eb9e

@TheCurle TheCurle added the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Sep 28, 2020
Comment thread src/main/java/net/minecraftforge/common/ForgeMod.java Outdated
@pupnewfster pupnewfster added 1.16.2 Feature This request implements a new feature. Fluids This request touches or otherwise deals with the fluids system. These requests require special care. Assigned This request has been assigned to a core developer. Will not go stale. and removed Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. labels Sep 30, 2020
@pupnewfster pupnewfster assigned LexManos and cpw and unassigned LexManos Sep 30, 2020
@Rosethorns
Copy link
Copy Markdown

I give my permission for Forge and all associated to use the milk fluid textures I created as linked.

@KnightMiner
Copy link
Copy Markdown
Contributor Author

Updated for current Forge mappings on the main repo, and resolved conflicts with ForgeMod again.

Fixes the previous broken code that was supposed to make mod registered milk returned by the vanilla bucket by allowing mods to enable a milk fluid.
@KingLemming
Copy link
Copy Markdown
Member

This seems fine to me - were we waiting on anything else?

@LexManos
Copy link
Copy Markdown
Member

LexManos commented Jan 5, 2021

No, It's fluids so you and cpw are the only one that touch it. If it doesn't break things I don't care.

@cpw
Copy link
Copy Markdown
Contributor

cpw commented Jan 17, 2021

Why is this PR a requirement?

@Buuz135
Copy link
Copy Markdown

Buuz135 commented Jan 17, 2021

Minecraft's milk bucket doesn't handle the fluid properly without a registry replacement and multiple modders might need milk as a fluid so this way we fix unnecesary fluid conflicts and registry replacements.

@cpw
Copy link
Copy Markdown
Contributor

cpw commented Jan 17, 2021

I approve and would have merged but the language changes need a local staging I cannot provide right now.

@cpw cpw merged commit 19f8d2a into MinecraftForge:1.16.x Jan 17, 2021
@KnightMiner KnightMiner deleted the 1.16-add-forge-milk branch January 17, 2021 23:19
50ap5ud5 pushed a commit to 50ap5ud5/MinecraftForge that referenced this pull request Feb 13, 2021
Fixes the previous broken code that was supposed to make mod registered milk returned by the vanilla bucket by allowing mods to enable a milk fluid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Assigned This request has been assigned to a core developer. Will not go stale. Feature This request implements a new feature. Fluids This request touches or otherwise deals with the fluids system. These requests require special care.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[1.15.2][1.16] Milk Bucket Fluid Wrapper forces the vanilla milk bucket to return no fluid

9 participants