From d1f2c9695c99542a1cd7aaf8a8877ceaeab92abf Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Feb 2026 13:27:29 +0000 Subject: [PATCH] Fix panel directional check to only block incoming projectiles The dot product was being computed but not used - panels were blocking projectiles from both sides. Now correctly checks which side the projectile approaches from and only blocks if it's moving toward the panel surface. https://claude.ai/code/session_01EV9KpiykvW4rASz7ju5iTG --- .../java/kamkeel/npcs/entity/EntityEnergyPanel.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/kamkeel/npcs/entity/EntityEnergyPanel.java b/src/main/java/kamkeel/npcs/entity/EntityEnergyPanel.java index ebc75bb0c..e28e5d53d 100644 --- a/src/main/java/kamkeel/npcs/entity/EntityEnergyPanel.java +++ b/src/main/java/kamkeel/npcs/entity/EntityEnergyPanel.java @@ -286,14 +286,18 @@ public class EntityEnergyPanel extends Entity implements IEntityAdditionalSpawnD if (Math.abs(localRight) > halfW) return false; if (Math.abs(relY) > halfH) return false; - // Check incoming direction (dot product with panel normal) + // Check incoming direction via dot product with panel normal double normalX = -Math.sin(yawRad); double normalZ = Math.cos(yawRad); double dot = projectile.motionX * normalX + projectile.motionZ * normalZ; - // If the projectile is on the owner's side, it must be moving toward the panel - // (negative dot means moving into the panel from the front side) - return true; // If within bounds, it's a hit regardless of direction + // Determine which side of the panel the projectile is on + // If on the front (localForward > 0), it must be moving backward (dot < 0) to be incoming + // If on the back (localForward < 0), it must be moving forward (dot > 0) to be incoming + if (localForward > 0 && dot >= 0) return false; // Moving away from front side + if (localForward < 0 && dot <= 0) return false; // Moving away from back side + + return true; } // ==================== HELPERS ====================