From f43dbd91f0d4d1be58a8414960bbb8a11a637e6a Mon Sep 17 00:00:00 2001 From: SamB440 Date: Wed, 12 Jun 2024 16:06:51 +0100 Subject: [PATCH] Fix scaling false with BadPacketsT --- .../grimac/checks/impl/badpackets/BadPacketsT.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java index 58623a8e2b..1d60ba01a4 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java @@ -36,21 +36,25 @@ public void onPacketReceive(final PacketReceiveEvent event) { if (packetEntity == null) { return; } + // Make sure our target entity is actually a player (Player NPCs work too) if (!EntityTypes.PLAYER.equals(packetEntity.getType())) { // We can't check for any entity that is not a player return; } + // Perform the interaction vector check // TODO: // 27/12/2023 - Dynamic values for more than just one entity type? // 28/12/2023 - Player-only is fine // 30/12/2023 - Expansions differ in 1.9+ - if (targetVector.y > minY && targetVector.y < maxY - && Math.abs(targetVector.x) < maxXZ - && Math.abs(targetVector.z) < maxXZ) { + final float scale = packetEntity.scale; + if (targetVector.y > (minY * scale) && targetVector.y < (maxY * scale) + && Math.abs(targetVector.x) < (maxXZ * scale) + && Math.abs(targetVector.z) < (maxXZ * scale)) { return; } + // Log the vector final String verbose = String.format("%.5f/%.5f/%.5f", targetVector.x, targetVector.y, targetVector.z);