Pufferfish stays inflated when an axolotl is playing dead
The Bug
A pufferfish will stay inflated when an axolotl is playing dead. This can cause the pufferfish to idly swim next to a playing dead axolotl and kill it.
To Reproduce
- Summon an axolotl playing dead using the command
/summon minecraft:axolotl ~ ~ ~ {Brain:{memories:{"minecraft:play_dead_ticks":{value:1000}}}} - Spawn a pufferfish next to it.
Observed Result
The pufferfish will inflate and poison the axolotl.
Expected Result
Pufferfish should not attack axolotls whilst they're playing dead.
Code Analysis & Fix
Code Analysis done by [Mod] Anthony Cicinelli
The reason the pufferfish is inflating is because no check is happening if the axolotl is playing dead or not in the Scary_Mob predicate. Adding a check in the predicate fixes the issue.
Current Code
net/minecraft/world/entity/animal/Pufferfish.java
public class Pufferfish extends AbstractFish { private static final EntityDataAccessor<Integer> PUFF_STATE = SynchedEntityData.defineId(Pufferfish.class, EntityDataSerializers.INT); int inflateCounter; int deflateTimer; private static final Predicate<LivingEntity> SCARY_MOB = (p_29634_) -> { if (p_29634_ instanceof Player && ((Player)p_29634_).isCreative())) { return false; } else { return p_29634_.getType() == EntityType.AXOLOTL || p_29634_.getMobType() != MobType.WATER; } };
Fixed Code
net/minecraft/world/entity/animal/Pufferfish.java
public class Pufferfish extends AbstractFish { private static final EntityDataAccessor<Integer> PUFF_STATE = SynchedEntityData.defineId(Pufferfish.class, EntityDataSerializers.INT); int inflateCounter; int deflateTimer; private static final Predicate<LivingEntity> SCARY_MOB = (p_29634_) -> { //Check if an axolotl isPlayingDead Fixes MC-225657 if (p_29634_ instanceof Player && ((Player)p_29634_).isCreative() || p_29634_ instanceof Axolotl && ((Axolotl)p_29634_).isPlayingDead()) { return false; } else { return p_29634_.getType() == EntityType.AXOLOTL || p_29634_.getMobType() != MobType.WATER; } };
2021-05-16, 05:49 PM
2024-08-02, 07:26 PM
6
2
-