The bug
canBreatheUnderwater() for guardian returns false instead they hard code the air time supply and don't bother with their own boolean system for EntityLiving.canBreatheUnderwater(). It should always return true but, it's always false. This is causing mod incompatibilities with vanilla itself.
How to fix
In the code return true rather than false for EntityLiving.canBreatheUnderwater() inside of the class EntityGuardian.class method override it.
Comments 9
the issue is when a minecraft mod/plugin accesses the information for can breath underwater and it returns false when it should be true thus breaking said mod/plugin.
your how to fix was wrong. It's a simple coding error for returning a method for water creatures.
from this:
canBreatheUnderwater(){ return false;}
To this:
canBreatheUnderwater(){ return true;}
this is a vanilla bug water breathing shouldn't be returning false and they set air rather then using can breath under water to true it's a object oriented error. And if you knew how to code you know if code isn't executed off of a broken method no bugs will be produced until another program tries to interface and receives wrong data. This is the case here as well as 1.13 data
Squids return true Guardians should return true as well period no debate learn how to code if you can't read my how to fix.
This is a vanilla issue soley caused by vanilla code the only reason why they are not drowning is because they are constantly refilling themselves rather then using the own system already in place. The boolean returning wrong is causing other things to go wrong to. I would assume this to be a major issue for 1.13 since all the water changes may depend on entityliving.canBreathUnderwater();
After talking to mojira mods, this is indeed a valid report, even though it does not have any effect on vanilla gameplay.
And yes, it is a very akward way of coding that.
After diving into the code this brings up another issue: guardians should be able to breathe on land which is why can breathe under water is false.
What should happen:
Separate booleans one for canBreathUnderWater() and one for canBreathOnLand()
Then gaurdians override canBreatheUnderWater() > true and canBreathOnLand() by default is true so nothing else should be done. In matter of fact this should be the default code here: canBreatheUnderWater()
{ return this instanceof EntityWaterCreature; }
canBreatheOnLand()
{ return !(this instanceof EntityWaterCreature); }
Then like I said before override the method in EntityGaurdian.class to just return true always and you got yourself a fixed bug. Hope this straightens things out there are actually two issues here a quickfix avoiding the real issue two booleans needed to be here not one
Guradians don't extend EntityWaterMob, which is part of the problem.EntityWaterMob actually does overwrite the method to always return true.
no it's not the problem I actually understand why they did not extend the water mob:
My code said what to return by default inside of the Entity.class I didn't say inside of the guardian class
Then in that endergardian class simply override the method to true thus fixing any issues
Can someone please check, if this still applies to 1.15.2 or the latest 1.16 development snapshot (currently that is 20w07a)?
Please make your description tidier so that everyone is easy to capture every section you said.
For example,
The bug:
canBreatheUnderwater() for gaurdian returns false instead they hard code the air time supply and don't bother with their own boolean system for EntityLiving.canBreatheUnderwater(). It should always return true but, it's always false
This is causing mod incompatibilities with vanilla itself.
How to fix:
Simple override the method in entity guardian to true it should take them < 1 minuet to do on their side so there should be no reason to put this to lower priorities since it can be fixed within 60 seconds.