From f81b95e39ff2ecfd153c66f9ec6d1afd005faa57 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 10 Dec 2024 12:57:21 +0100 Subject: [PATCH] Fix direction id. --- .../src/de/steamwar/fightsystem/utils/Hull.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java index a7f6f170..0ec723cc 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java @@ -69,7 +69,7 @@ public class Hull { branchDirections = IntStream.range(0, 27) .mapToObj(v -> new IntVector(v%3 -1, (v/3)%3 -1, v/9 -1)) - .filter(v -> v.x*primaryDirection.x + v.y*primaryDirection.y + v.z*primaryDirection.z == 1) // Pointing towards primary direction + .filter(v -> v.x*primaryDirection.x + v.y*primaryDirection.y + v.z*primaryDirection.z >= 0) // Not pointing away from primary direction .filter(v -> v.x*v.x + v.y*v.y + v.z*v.z == 2) // Diagonal .toArray(IntVector[]::new); } @@ -87,6 +87,7 @@ public class Hull { } public void addPlayer(Player player) { + System.out.println("Added " + player + " to " + region.centerZ()); if(players.add(player)) { for(Entity entity : entities) BlockIdWrapper.impl.untrackEntity(player, entity.getEntityId()); @@ -94,6 +95,7 @@ public class Hull { } public void removePlayer(Player player, boolean activeRemoval) { + System.out.println("Removed " + player + " from " + region.centerZ()); if(players.remove(player) && activeRemoval) { for(Entity entity : entities) BlockIdWrapper.impl.trackEntity(player, entity.getEntityId()); @@ -266,7 +268,7 @@ public class Hull { } private int directionId(IntVector v) { - return 9*(v.z+1) + 3*(v.y+1) + (v.x+1); + return 1 << (9*(v.z+1) + 3*(v.y+1) + (v.x+1)); }