The bug
Mobs with multiple states have their hitboxs shifted when they spawn (except for the first basic state).
How to reproduce
Press
F3
+B
to make hitboxes visibleUse the following command
/summon slime ~ ~ ~ {NoAI:1b,NoGravity:1b,Size:3}
→ The hitbox starts at the back of the baby animal, but then jumps into the middle.
Examples
Magma Cube:
and
Pufferfish:
Slime:
Code analysis
Code analysis by @unknown can be found in this comment.
Related issues
is duplicated by
Attachments
Comments


Can reproduce with
/summon Wolf ~ ~3 ~ {Age:-2000}

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.

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, @unknown }=)

Relates to MC-9568

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

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

Confirmed for 17w17b

Confirmed for 17w18a
Also occurs with pufferfish, according to MC-148203.

Confirmed in 1.14 Pre-Release 2.
Also affects Pufferfish!
The bug
Mobs with multiple states have their hitboxs shifted when they spawn (except for the first basic state).
See examples for more infos.
How to reproduce
Activate hitboxes with F3+B
Spawn a mob (like a Magma Cube or a Slime or a Pufferfish) and look at the hixbox of the mob
Examples
Here are examples in videos:
• Magma Cube:
[media]and
[media]• Pufferfish:
[media]• Slime:
[media]Additional information
This bug occurs both when the mob appears with an spawn egg or a command (/summon).

Still in 1.14 pre-3, 1.14 pre-4 and 1.14 pre-5

Still in 1.14 Release

Still in 1.14.1 Release

Still in 1.14.2 Pre-Release 1 and 1.14.2 Pre-Release 2
Fixed according to @unknown.

No, this is not fixed. The issue can be seen clearly following the reproduction steps. Nothing has changed here.

I found the issue why I couldn't reproduce it before: Apparently their hitbox now corrects itself as soon as they move. And because they normally start jumping pretty quickly after spawning, it can only be seen properly with NoAI.
Also, they can not suffocate because of this, even though it's not just a visual issue (persists after reloading).