Minecraft
  1. Minecraft
  2. MC-103313

Hitbox of baby mobs / slime / magma cube / llama are offset for some seconds

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.10, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w38a, Minecraft 16w39b, Minecraft 16w41a, Minecraft 16w42a, Minecraft 1.11.2
    • Fix Version/s: Minecraft 16w43a
    • Security Level: Minecraft - Public (Viewable by everyone)
    • Confirmation Status:
      Confirmed

      Description

      The Bug:
      The hitbox of any baby mob jumps to a different location inside the animal shortly after summoning it.

      Also affect the use of spawn eggs.

      Reproduce:
      1. Go into third person view.
      2. Press F3+B.
      3. Type into chat:

      /summon Wolf ~ ~ ~ {Age:-2000,NoAI:1,NoGravity:1}

      Result: Hitbox starts at the back of the baby animal, but then jumps into the middle. That might lead to some suffocation, although it's not nearly as bad as MC-50367. I found it out while testing for that bug.

      Also affects the Zombie / Husk / Zombie Pigman / Zombie Villager / Horse / Armor Stand / slime / magma cube / llama


      Code analysis by [Helper] Marcono1234 in this comment.

      1. 2016-08-13_04.17.59.png
        268 kB
      2. 2016-08-13_04.18.09.png
        354 kB
      3. 2016-08-13_04.19.28.png
        177 kB
      4. 2016-08-13_04.19.47.png
        435 kB
      5. 2016-10-15_12.35.27.png
        534 kB
      6. 2016-10-15_12.36.13.png
        300 kB
      7. 2016-10-15_12.36.42.png
        425 kB
      8. Small armor stand offset hitbox (16w38a).png
        112 kB

        Issue Links

          Activity

          Hide
          [Mod] SunCat added a comment - - edited

          Can reproduce with

          /summon Wolf ~ ~3 ~ {Age:-2000}
          Show
          [Mod] SunCat added a comment - - edited Can reproduce with /summon Wolf ~ ~3 ~ {Age:-2000}
          Hide
          [Helper] Marcono1234 added a comment - - edited

          Please link to this comment in the description

          The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

          The reason for this is that the method net.minecraft.entity.Entity.setSize(float, float) sets the bounding box based on the min values of the current bounding box. This means if the entity becomes smaller, its hitbox is offset in -x and -z direction; if it becomes larger its hitbox is offset in +x and +z direction. The case in which an entity becomes larger is handled by moving the entity in the according direction, however in case it becomes smaller the hitbox remains offset.

          I would suggest centering the hitbox on the current position of the entity instead.

          Suggested change (MCP 9.30, Minecraft 1.10)
          protected void setSize(float width, float height)
          {
              if (width != this.width || height != this.height)
              {
                  // Replaced this
                  //float f = this.width;
                  //this.width = width;
                  //this.height = height;
                  //AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
                  //this.setEntityBoundingBox(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + (double)this.width, axisalignedbb.minY + (double)this.height, axisalignedbb.minZ + (double)this.width));
                  //
                  //if (this.width > f && !this.firstUpdate && !this.worldObj.isRemote)
                  //{
                  //    this.moveEntity((double)(f - this.width), 0.0D, (double)(f - this.width));
                  //}
                   this.width = width;
                   this.height = height;
                   double halfWidth = width / 2d;
          
                   this.setEntityBoundingBox(new AxisAlignedBB(this.posX - halfWidth, this.posY, this.posZ - halfWidth, this.posX + halfWidth, this.posY + height, this.posZ + halfWidth));
              }
          }
          

          Note: One problem which existed before and will still exist is that in case the entity becomes larger its hitbox might afterwards intersect with blocks allowing it to clip through them.

          Show
          [Helper] Marcono1234 added a comment - - edited Please link to this comment in the description The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30. The reason for this is that the method net.minecraft.entity.Entity.setSize(float, float) sets the bounding box based on the min values of the current bounding box. This means if the entity becomes smaller, its hitbox is offset in -x and -z direction; if it becomes larger its hitbox is offset in +x and +z direction. The case in which an entity becomes larger is handled by moving the entity in the according direction, however in case it becomes smaller the hitbox remains offset. I would suggest centering the hitbox on the current position of the entity instead. Suggested change (MCP 9.30, Minecraft 1.10) protected void setSize( float width, float height) { if (width != this .width || height != this .height) { // Replaced this // float f = this .width; // this .width = width; // this .height = height; //AxisAlignedBB axisalignedbb = this .getEntityBoundingBox(); // this .setEntityBoundingBox( new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + ( double ) this .width, axisalignedbb.minY + ( double ) this .height, axisalignedbb.minZ + ( double ) this .width)); // // if ( this .width > f && ! this .firstUpdate && ! this .worldObj.isRemote) //{ // this .moveEntity(( double )(f - this .width), 0.0D, ( double )(f - this .width)); //} this .width = width; this .height = height; double halfWidth = width / 2d; this .setEntityBoundingBox( new AxisAlignedBB( this .posX - halfWidth, this .posY, this .posZ - halfWidth, this .posX + halfWidth, this .posY + height, this .posZ + halfWidth)); } } Note: One problem which existed before and will still exist is that in case the entity becomes larger its hitbox might afterwards intersect with blocks allowing it to clip through them.
          Hide
          Meri Diana added a comment -

          Confirmed for 16w41a: When baby mobs (e.g. Villagers) are in a confined space (e.g. 1x1 tube) they can gllitch out of it as soon as they grow up.

          Thanks for the link to the correct bugpost, [Mod] SunCat }=)

          Show
          Meri Diana added a comment - Confirmed for 16w41a: When baby mobs (e.g. Villagers) are in a confined space (e.g. 1x1 tube) they can gllitch out of it as soon as they grow up. Thanks for the link to the correct bugpost, [Mod] SunCat }=)
          Hide
          [Mod] SunCat added a comment - - edited

          Relates to MC-9568

          Show
          [Mod] SunCat added a comment - - edited Relates to MC-9568
          Hide
          [Helper] Fabian Röling added a comment -

          Related. Apparently the same thing happens for one tick after growing up.

          Show
          [Helper] Fabian Röling added a comment - Related. Apparently the same thing happens for one tick after growing up.
          Hide
          [MCPE Mod] SuperGeniusZeb added a comment -

          Reopening, as this bug still affects slimes & magma cubes with a "Size" greater than 0.

          Show
          [MCPE Mod] SuperGeniusZeb added a comment - Reopening, as this bug still affects slimes & magma cubes with a "Size" greater than 0.

            People

            • Assignee:
              [Mojang] Agnes Larsson
              Reporter:
              [Helper] Fabian Röling
            • Votes:
              6 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: