From 0eaf9587d8999a3c9ab96084d915c9fca1198f1a Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 6 Mar 2013 04:08:20 +0100 Subject: [PATCH] Add null check and refine preconditions for on-ground shortcut. --- .../fr/neatmonster/nocheatplus/utilities/PlayerLocation.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java index ee992840..7c1bb19d 100644 --- a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java +++ b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java @@ -446,9 +446,11 @@ public class PlayerLocation { final long flags = BlockProperties.getBlockFlags(id); if ((flags & BlockProperties.F_GROUND) != 0 && (flags & BlockProperties.F_VARIABLE) == 0){ final double[] bounds = blockCache.getBounds(blockX, bY, blockZ); - if (BlockProperties.collidesBlock(blockCache, x, minY - yOnGround, z, x, minY, z, blockX, bY, blockZ, id, bounds, flags)){ + // Check collision if not inside of the block. [Might be a problem for cauldron or similar + something solid above.] + if (bounds != null && y - bY >= bounds[4] && BlockProperties.collidesBlock(blockCache, x, minY - yOnGround, z, x, minY, z, blockX, bY, blockZ, id, bounds, flags)){ // TODO: passable vs maxY ? if (!BlockProperties.isPassableWorkaround(blockCache, blockX, bY, blockZ, minX - blockX, minY - yOnGround - bY, minZ - blockZ, id, maxX - minX, yOnGround, maxZ - minZ, 1.0)){ + // TODO: Might have to exclude on base of maxY, for case of being inside of blocks doors etc. onGround = true; } }