From 6f65a2faa0a9688f1f15bdc5b45473ccdd03ba02 Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 12 Aug 2012 07:37:52 +0200 Subject: [PATCH] TEST: Introduce absolute reference y for NoFall. --- .../nocheatplus/checks/moving/MovingData.java | 1 + .../nocheatplus/checks/moving/NoFall.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java b/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java index b8b3ef07..a2b439ff 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java @@ -88,6 +88,7 @@ public class MovingData implements CheckData { public boolean noFallOnGroundServer; public boolean noFallWasOnGroundClient; public boolean noFallWasOnGroundServer; + public double noFallY; // Data of the survival fly check. public int survivalFlyJumpPhase; diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java b/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java index 1b0cb1a7..81453d01 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java @@ -87,6 +87,7 @@ public class NoFall extends Check { if (!damageEvent.isCancelled()) player.damage(damageEvent.getDamage()); } data.noFallFallDistance = 0.0; + data.noFallY = to.getY(); player.setFallDistance(0.0f); } @@ -106,9 +107,11 @@ public class NoFall extends Check { data.noFallVL += data.noFallFallDistance - player.getFallDistance(); // Execute the actions to find out if we need to cancel the event or not. - if (executeActions(player, data.noFallVL, cc.noFallActions)) - // Set the fall distance to its right value. + if (executeActions(player, data.noFallVL, cc.noFallActions)){ + // Set the fall distance to its right value. player.setFallDistance((float) data.noFallFallDistance); + } + } else // Reward the player by lowering his violation level. data.noFallVL *= 0.95D; @@ -151,9 +154,11 @@ public class NoFall extends Check { final AxisAlignedBB boundingBoxGround = player.boundingBox.clone().d(packet.x - player.locX, packet.y - player.locY - 0.001D, packet.z - player.locZ); data.noFallOnGroundServer = player.world.getCubes(player, boundingBoxGround).size() > 0; - if (packet.hasPos && data.noFallWasOnGroundServer && !data.noFallOnGroundServer) - data.noFallFallDistance = 0D; + if (packet.hasPos && data.noFallWasOnGroundServer && !data.noFallOnGroundServer){ + data.noFallFallDistance = 0D; + data.noFallY = player.locY; + } else if (packet.hasPos && player.locY - packet.y > 0D) - data.noFallFallDistance += player.locY - packet.y; + data.noFallFallDistance = Math.max(0.0, data.noFallY - player.locY); //+= player.locY - packet.y; } }