Yarn: Entity#isInWater, Entity#isTouchingWater and Entity#isInsideWater are confusing names.

Created on 12 Nov 2019  ·  8Comments  ·  Source: FabricMC/yarn

Methods isInWater and isInsideWater are currently very confusing: the methods have very similar names but doesn't return the same result at all.

isInWater returns true only when the full hitbox is in water, and should be renamed to isSubmergedInWater. And isInWater returns the value of the field inWater which is set by isSubmergedIn(FluidTags.WATER, true).
Renaming the inWater field should also be done then.

isInsideWater returns true when the hitbox hits water, the method should be renamed to isTouchingWater. The associated field insideWater should also be renamed.

As isTouchingWater already exists, the method should also be renamed.
The name isWet came in some minds but it might conflict with WolfEntity#isWet which is client-side only.

bug

Most helpful comment

This issue is fixed with #1058 now.

All 8 comments

Maybe we could rename WolfEntity#isWet to isWolfWet ?

My problem by renaming isTouchingWater to isWet is it's not entirely correct on a language point of view. You can be wet for a certain time after touching water. I thought of isMakingContactWithWater but it's way too long.

Could always be isTouchingWaterBlock and isTouchingWater. It's not ideal but it should be clear enough.

Since the isWet method is a separate method in WolfEntity (rather than just using Entity.isWet, or overriding it), I'm guessing that the Mojang name is probably something like shouldDoXyz, where "xyz" is something that wolves do only when wet.

Depends. Wolfs shake their body when they are wet, and if they are wet water particles are rendered on them as well. shouldDoXyz may not fit as well for the particle render case.

@Runemoro I agree with that. Might be isFurWet or isASoggyBoi.

Situation might be that the method on wolves predates the methods on Entity.

+1 for Wolf#isFurWet

This issue is fixed with #1058 now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Awakened-Redstone picture Awakened-Redstone  ·  4Comments

ChloeDawn picture ChloeDawn  ·  6Comments

quat1024 picture quat1024  ·  6Comments

asiekierka picture asiekierka  ·  3Comments

Runemoro picture Runemoro  ·  4Comments