mojira.dev
MC-230660

Foxes don't get stuck on powder snow like on snow layers

The bug

Foxes do not get stuck on powder snow like on snow layers.

Steps to reproduce

  1. Make two platforms separated by a 2 block gap, One of powder snow and another of Grass and Snow Layers

  2. Place foxes on the powder snow platform and chickens/rabbits on the other one

  3. Kill the rabbit/chicken when a fox jumps, before it lands. The fox gets stuck in the snow

  4. Now place the foxes on the Snow Layer platform and the rabbit/chicken in the powder snow platform

  5. 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

I can confirm that this is an issue. Also affects 1.17.1 Pre-release 2.

Can confirm in 1.17.1.

Can confirm in 1.18.1.

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.

Can confirm in 1.19.

Do they get stuck on snow blocks as well, and if not, would this be an issue?

Lerizo23

(Unassigned)

Confirmed

Gameplay

Low

Mob behaviour

1.17, 1.17.1 Pre-release 2, 1.17.1, 1.18.1, 22w18a, 1.19, 1.19.4 Pre-release 3, 1.19.4, 23w14a

Retrieved