Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-217158

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 21w08b, 21w10a, 21w11a, 21w13a, 21w14a, 21w15a, 21w16a, 21w17a, 21w18a, 21w19a, 21w20a, 1.17 Pre-release 1, 1.17 Pre-release 3, 1.17 Pre-release 4, 1.17 Pre-release 5, 1.17 Release Candidate 1, 1.17 Release Candidate 2, 1.17, 1.17.1 Pre-release 1, 1.17.1 Release Candidate 1, 1.17.1, 21w37a, 21w40a, 1.18, 1.18.1, 22w05a, 1.18.2, 1.19, 1.19.2, 1.19.3, 1.19.4, 1.20.1, 1.20.4, 23w51b
    • Confirmed
    • Particles
    • Normal
    • Gameplay

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

        1. 2021-02-26_19.26.22.png
          2021-02-26_19.26.22.png
          391 kB
        2. 2021-05-12_13.08.23.png
          2021-05-12_13.08.23.png
          502 kB
        3. MC-217158.mp4
          4.42 MB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            10 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: