From b0b898b9f9c5b46d00142c56e13fa9843b7298cb Mon Sep 17 00:00:00 2001 From: asofold Date: Tue, 6 Jan 2015 04:05:11 +0100 Subject: [PATCH] Fix up some width and height calculations (low jump, workarounds). --- .../nocheatplus/checks/moving/SurvivalFly.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index ac0fb067..b8a0931e 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -825,8 +825,10 @@ public class SurvivalFly extends Check { } if (setBackYDistance < estimate) { // Low jump, further check if there might have been a reason for low jumping. - final double width = from.getWidth(); - final long aboveFlags = BlockProperties.collectFlagsSimple(from.getBlockCache(), from.getX() - width, from.getY(), from.getZ() - width, from.getX() + width, from.getY() + 0.1, from.getZ() + width); + // TODO: Might provide access methods in PlayerLoction instead. + final double width = Math.round(from.getWidth() * 500.0) / 1000.0; + final double eyeHeight = player.getEyeHeight(); + final long aboveFlags = BlockProperties.collectFlagsSimple(from.getBlockCache(), from.getX() - width, from.getY() + eyeHeight, from.getZ() - width, from.getX() + width, from.getY() + eyeHeight + 0.25, from.getZ() + width); if ((aboveFlags & (BlockProperties.F_GROUND | BlockProperties.F_SOLID)) == 0) { tags.add("lowjump"); data.sfLowJump = true; @@ -1174,7 +1176,7 @@ public class SurvivalFly extends Check { // Check full bounding box since last from. final double minY = Math.min(data.toY, Math.min(data.fromY, from.getY())); final double iY = minY; // TODO ... - final double r = from.getWidth() / 2.0; // TODO: check + 0.35; + final double r = Math.round(from.getWidth() * 500.0) / 1000.0 / 2.0; // TODO: check + 0.35; double yMargin = cc.yOnGround; // TODO: Might set margin higher depending on distance to 0 of block and last y distance etc. // TODO: check with iY + 0.25 removed.