The bug
Foxes do not get stuck on powder snow like on snow layers.
Steps to reproduce
Make two platforms separated by a 2 block gap, One of powder snow and another of Grass and Snow Layers
Place foxes on the powder snow platform and chickens/rabbits on the other one
Kill the rabbit/chicken when a fox jumps, before it lands. The fox gets stuck in the snow
Now place the foxes on the Snow Layer platform and the rabbit/chicken in the powder snow platform
Notice how the foxes just stand on the powder snow instead of getting stuck
Code analysis
Code analysis can be found in this comment.
Attachments
Comments 8
@unknown This is not a duplicate @unknown was told to make a new report here
Code analysis (Mojang mappings, 22w18a):
In Fox#tick()
:
...
if ($$0 != null && Fox.this.distanceTo((Entity)$$0) <= 2.0f) {
Fox.this.doHurtTarget($$0);
} else if (Fox.this.getXRot() > 0.0f && Fox.this.onGround && (float)Fox.this.getDeltaMovement().y != 0.0f && Fox.this.level.getBlockState(Fox.this.blockPosition()).is(Blocks.SNOW)) {
Fox.this.setXRot(60.0f);
Fox.this.setTarget(null);
Fox.this.setFaceplanted(true);
}
...
So, foxes only get stuck on snow (layer) blocks. This could be fixed by changing this conditional:
else if (Fox.this.getXRot() > 0.0f && Fox.this.onGround && (float)Fox.this.getDeltaMovement().y != 0.0f && Fox.this.level.getBlockState(Fox.this.blockPosition()).is(Blocks.SNOW))
to
else if (Fox.this.getXRot() > 0.0f && Fox.this.onGround && (float)Fox.this.getDeltaMovement().y != 0.0f && (Fox.this.level.getBlockState(Fox.this.blockPosition()).is(Blocks.SNOW) || Fox.this.level.getBlockState(Fox.this.blockPosition()).is(Blocks.POWDER_SNOW))
which is admittedly quite clunky but it should do the job.
Duplicates MC-205256