ExampleMod-1.12
ExampleMod-1.12 copied to clipboard
A few issues with fluids
Hi, just wanted to point out a few issues I found in some of the tutorials:
-
When implementing the FogDensity event, never set the density to something like
0.0001F
. If the player isn't inside the cloud dimension or slime liquid, don't cancel it, because that will break vanilla behavior (such as being inside water/lava), and potentially other mods that use the event. Similarly with the FogColors event, if you're not changing anything then don't set any default values (and probably don't usereceiveCancelled
). -
When you check if the player is inside the slime liquid on client side, vanilla does that using
ActiveRenderInfo.getBlockStateAtEntityViewpoint
. UsingisInsideOfMaterial
breaks third person view, and can cause issues when the player is extremely close to the liquid and rotates the camera. -
I noticed you use
ReflectionHelper
, especially for http://jabelarminecraft.blogspot.com/p/minecraft-modding-getting-air-supply.html - reflection is much slower than accessing the fields directly, please use an access transformer instead. (I also wouldn't recommend cancelling the LivingUpdateEvent and completely replacing it, it's always a pain to update to a new MC version; there must be a better way to implement drowning)
Thanks for the tutorials; they are really useful, hopefully you can update them to fix these issues because it could be a problem if someone just copy/pastes the code.