Game Output
[16:57:52] [Client thread/ERROR]: Null returned as 'hitResult', this shouldn't happen!
[16:57:52] [Client thread/WARN]: Null returned as 'hitResult', this shouldn't happen!
How to reproduce
Go to a wall which has at least 6 (+1 where you should stand) ladders below or above you
Click the mouse
Observe that the item in your hand is not swung, and that a warning is printed in the log
Affects all blocks that allow you to stand in them and punch without hitting them, including:
Ladders
Vines
Iron bars
Glass panes
Portal blocks
...
Not restricted to only the vertical axis - can also happen when looking sideways.
Code analysis
Code analysis by @unknown can be found in this comment.
Related issues
is duplicated by
Attachments
Comments


Confirmed for
1.8.4
1.8.6
How to reproduce:
Gamemode Creative or Survival (at least I can confirm it for these both)
Go to a wall which has at least 6 (+1 where you should stand) ladders below or above you and punch down respectively up

Can confirm in 15w36d. Near/on ladders when messages displayed.

Relates to:
Confirmed for
15w50a
Affects all blocks that allow you to stand in them and punch without hitting them, like:
Ladders
Vines
Iron bars
Glas panes
Portal blocks
...
The main bug might be in the collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
method of the /Client/src/net/minecraft/block/Block.java
class. If all collision checks fail null
is returned, however it should maybe rather be returned that the player missed. I added that however the EnumFacing
needs to be adjusted and the other arguments might be wrong as well.
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
*
* @param start The start vector
* @param end The end vector
*/
public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
{
this.setBlockBoundsBasedOnState(worldIn, pos);
start = start.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
end = end.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
Vec3 var5 = start.getIntermediateWithXValue(end, this.minX);
Vec3 var6 = start.getIntermediateWithXValue(end, this.maxX);
Vec3 var7 = start.getIntermediateWithYValue(end, this.minY);
Vec3 var8 = start.getIntermediateWithYValue(end, this.maxY);
Vec3 var9 = start.getIntermediateWithZValue(end, this.minZ);
Vec3 var10 = start.getIntermediateWithZValue(end, this.maxZ);
//... Collision tests, var11 is null if none succeeded
if (var11 == null)
{
//return null;
// EnumFacing.DOWN is probably wrong
return new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, start, EnumFacing.DOWN, pos);
}
else
{
//...
}
}
Please keep in mind that this is only based on partwise obfuscated code so this might not be the actual fix needed.

I updated the comment. The floor implementation was correct, I got there something wrong, sorry 😞

Still in 1.9.4
I think this and MC-89132 should be combined, because they occur in the same circumstances (so, your hand doesn't swing AND game output says hitResult is null)

They're already marked as related, so it's not really necessary.
Can confirm for MC 1.12.1.

Can confirm for 1.13.2.

Can anyone reproduce this in 19w03a? It seems to be fixed there for me.

Resolving as fixed for 19w03a, since a lot of the related code was changed so I assume this bug was also fixed with that. (I haven't fully verified that the offending bit of the code was changed; the collision code is hard for me to navigate).
If anyone can still reproduce, let me know.