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

Sniffer digging does not account for scale attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 23w51a, 24w13a, 1.20.5 Pre-Release 4, 1.20.5, 1.20.6 Release Candidate 1, 1.20.6, 24w19b, 1.21
    • Confirmed
    • Commands
    • Low
    • Platform

      Sniffers digging into the ground does not account for the scale attribute, resulting in the sniffer being able to dig multiple blocks away from their own position, or dig far too close to their inner hitbox at larger scales.

      Steps to Reproduce:

      1. Create a super flat world
      2. Summon/spawn a sniffer
      3. Scale it downward to 0.25
        /attribute @e[type=minecraft:sniffer,limit=1] minecraft:scale base set 0.25
        
      4. Wait for it to sniff a block

      Observed Behavior:

      The sniffer will play the animation as expected, but the block they dig over (and the block that shows particles) will be upwards of 2-3 blocks away from themselves. The behavior when scaling the sniffer upwards will be that the sniffer digs central to it's hitbox, disregarding it's head position.

      Expected Behavior:

      The sniffer in all cases would dig where it's head enters the ground, underneath it's hitbox.

      Screenshots/Videos:

      Code Analysis:

      (From haykam in this comment)
      The SnifferEntity#getDigLocation method uses a constant value of 2.25 when calculating the magnitude of the vector from the entity's rotation and bottom-center position, which is proportional to the typical sniffer's dimensions. A scaled sniffer, however, does not scale this constant value. A proposed fix is to use the expression 2.25 * this.getScale() instead.

            Unassigned Unassigned
            Jingy [Helper] Jiingy
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: