Affects Version/s: Minecraft 1.8
Fix Version/s: Minecraft 1.8.1-pre1
When the following conditions are given entities will fall though the floor:
- The entity needs to be able to walk up a slab
- It needs to stand on the ground (NBTTag OnGround:true)
- It needs to move upwards and to the side
- It needs to hit a block which it wouldn't hit if it was only moving up or only moving to the side
How to reproduce:
1. Put down a mob and a block on offset on top of it (Screenshot)
2. Punch the mob (easiest way to get a sideways upwards motion) against the block.
3. The mob will fall through the floor now.
The source of the bug is in the method which moves an entity in Entity.java.
In MCP: public void moveEntity(double x, double y, double z). Sure you will find it
This shows what needs to be changed to fix it (with some context): https://gist.github.com/Panda4994/9d83d261f5edffc3037e/revisions
I will also describe the problem and fix here:
So the problem is the part of the code which calculates the moving up slabs.
When a entity hits a block while moving sideways it will be called.
Then the game will make a list of all bounding boxes it could collide with when moving up by the step height of the entity (0.6 for normal mobs, 1.0 for enderman and horses) and the given amount in x and z direction.
This will not get the floor below the entity.
Now in this part of code a bounding box (BB from here on) will get moved to the position where it could go if no blocks were in the way.
Then the BB will get moved up till it hits something but at max the step height.
In the case described further up it will not move up the full step height.
Some other calculations follow.
Then the entity gets moved down till it hits a block but at max the step height.
It uses the list it created earlier for this check. So if the entity wasn't moved up by the step height it will get moved below the floor because the floor is not in the list.
An easy fix would be to just set the maximum it would get moved down to how far it got moved up.