mojira.dev
MC-213309

Particles produced from powder snow appear slightly too high

The Bug:

Particles produced from powder snow appear slightly too high.

Steps to Reproduce:

  1. Enable entity hitboxes by pressing "F3 + B".

  2. Sneak and walk along the edge of powder that is 2+ blocks high.

  3. Switch into third person so that you can see the particles being produced.

  4. Take note as to whether or not particles produced from powder snow appear slightly too high.

Observed Behavior:

Particles are produced slightly too high.

Expected Behavior:

Particles would not be produced slightly too high.

Code Analysis:

Code analysis by @unknown can be found below.

The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.

net.minecraft.world.level.block.PowderSnowBlock.java

public class PowderSnowBlock extends Block implements BucketPickup {
   ...
   public void entityInside(BlockState $bs, Level $l, BlockPos $bp, Entity $e) {
      if (!($e instanceof LivingEntity) || $e.getFeetBlockState().is(this)) {
         $e.makeStuckInBlock($bs, new Vec3((double)0.9F, 1.5D, (double)0.9F));
         if ($l.isClientSide) {
            Random random = $l.getRandom();
            boolean flag = $e.xOld != $e.getX() || $e.zOld != $e.getZ();
            if (flag && random.nextBoolean()) {
               $l.addParticle(ParticleTypes.SNOWFLAKE, $e.getX(), (double)($bp.getY() + 1), $e.getZ(), (double)(Mth.randomBetween(random, -1.0F, 1.0F) * 0.083333336F), (double)0.05F, (double)(Mth.randomBetween(random, -1.0F, 1.0F) * 0.083333336F));
            }
         }
      }
      ...

If we look at the above class, we can see that the "y" level of where powder snow particles are produced is determined by one block above the powder snow block's position. This is evident through the following line of code:

($bp.getY() + 1)

As a result of this, in some cases, the particles can appear too high.

Linked issues

Attachments

Comments 3

Can confirm, the paritcles don’t seem to adjust their hight when sneaking, even though your hitbox becomes smaller.

I've edited this report to mention that the particles produced from powder snow, appear too high above an entity's hitbox, not just the player sneaking.

Avoma

(Unassigned)

Confirmed

Platform

Normal

Particles

powder_snow

21w03a, 21w05a, 21w05b, 21w06a, 21w07a, ..., 1.19.4, 1.20.1, 1.21, 1.21.4, 1.21.7

Retrieved