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
This commit is contained in:
Claude committed 2026-02-16 13:27:29 +00:00
1 parent 0ebdfafccd
commit d1f2c9695c
1 file changed
+8 -4
@@ -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 ====================