mojira.dev
MC-217158

Particles produced from powder snow always appear at the center of entities' hitboxes

The Bug:

Particles produced from powder snow always appear at the center of entities' hitboxes.

Steps to Reproduce:

  1. Place a boat right beside some powder snow.

  2. Push the boat a bit so that some powder snow particles are produced from the boat moving.

  3. Take note as to whether or not particles produced from powder snow always appear at the center of entities' hitboxes.

Observed Behavior:

Particles produced from powder snow always appear at the center of entities' hitboxes.

Expected Behavior:

Particles produced from powder snow would not always appear at the center of entities' hitboxes. Instead, they should appear where the model comes in contact with the powder snow.

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 "x" and "z" levels of where powder snow particles are produced are determined by the entity's position. This is evident through the following lines of code:

$e.getX()
$e.getZ()

Since by default, the "x" and "z" positions of an entity are located at the center of their hitbox, this results in powder snow particles always being produced here.

Linked issues

Attachments

Comments 1

Can confirm, may be related to MC-163944

Avoma

(Unassigned)

Confirmed

Gameplay

Normal

Particles

powder_snow

21w08b, 21w10a, 21w11a, 21w13a, 21w14a, ..., 23w51b, 1.21, 1.21.3, 1.21.4, 1.21.7

Retrieved