diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index 0a9aad1..84e07fb 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -195,11 +195,14 @@ public class PacketProcessor { private void entityMoves() throws IOException { int entityId = source.readInt(); - double locX = source.readDouble() - arenaMinX + Config.ArenaRegion.getMinX(); + double x = source.readDouble() - arenaMinX; double locY = source.readDouble() - arenaMinY + Config.BluePasteRegion.getMinY(); double z = source.readDouble() - arenaMinZ; - if(rotateZ) + if(rotateZ) { + x = Config.ArenaRegion.getSizeX() - x; z = Config.ArenaRegion.getSizeZ() - z; + } + double locX = x + Config.ArenaRegion.getMinX(); double locZ = z + Config.ArenaRegion.getMinZ(); float pitch = source.readFloat(); float yaw = source.readFloat() + (rotateZ ? 180 : 0); @@ -237,7 +240,7 @@ public class PacketProcessor { private void entityVelocity() throws IOException { int entityId = source.readInt(); - double dX = source.readDouble(); + double dX = rotateZ ? -source.readDouble() : source.readDouble(); double dY = source.readDouble(); double dZ = rotateZ ? -source.readDouble() : source.readDouble(); @@ -306,8 +309,10 @@ public class PacketProcessor { int z = Byte.toUnsignedInt(source.readByte()); int blockState = source.readShort(); - if(rotateZ) + if(rotateZ) { + x = Config.ArenaRegion.getSizeX() - x; z = Config.ArenaRegion.getSizeZ() - z; + } setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState); } @@ -318,8 +323,10 @@ public class PacketProcessor { int z = source.readInt() - arenaMinZ; int blockState = source.readInt(); - if(rotateZ) + if(rotateZ) { + x = Config.ArenaRegion.getSizeX() - x; z = Config.ArenaRegion.getSizeZ() - z; + } setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState); } @@ -332,22 +339,32 @@ public class PacketProcessor { } private void particle() throws IOException { - double x = source.readDouble(); - double y = source.readDouble(); - double z = source.readDouble(); + double x = source.readDouble() - arenaMinX; + double y = source.readDouble() - arenaMinY; + double z = source.readDouble() - arenaMinZ; String particleName = source.readUTF(); - execSync(() -> BountifulWrapper.impl.spawnParticle(world, particleName, x, y, z)); + if(rotateZ) { + x = Config.ArenaRegion.getSizeX() - x; + z = Config.ArenaRegion.getSizeZ() - z; + } + + double finalX = x; + double finalZ = z; + execSync(() -> BountifulWrapper.impl.spawnParticle(world, particleName, finalX + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), finalZ + Config.ArenaRegion.getMinZ())); } private void sound() throws IOException { - int x = source.readInt() - arenaMinX + Config.ArenaRegion.getMinX(); + int rawX = source.readInt() - arenaMinX + Config.ArenaRegion.getMinX(); int y = source.readInt() - arenaMinY + Config.BluePasteRegion.getMinY(); int rawZ = source.readInt() - arenaMinZ; - if(rotateZ) + if(rotateZ) { + rawX = Config.ArenaRegion.getSizeX() - rawX; rawZ = Config.ArenaRegion.getSizeZ() - rawZ; + } + int x = rawX + Config.ArenaRegion.getMinX(); int z = rawZ + Config.ArenaRegion.getMinZ(); String soundName = source.readUTF();