SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Fix replay rotation' (#321) from fixRotation into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #321
Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Lixfel 2022-01-06 16:49:38 +01:00
Commit 247f8e47f3

Datei anzeigen

@ -195,11 +195,14 @@ public class PacketProcessor {
private void entityMoves() throws IOException { private void entityMoves() throws IOException {
int entityId = source.readInt(); 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 locY = source.readDouble() - arenaMinY + Config.BluePasteRegion.getMinY();
double z = source.readDouble() - arenaMinZ; double z = source.readDouble() - arenaMinZ;
if(rotateZ) if(rotateZ) {
x = Config.ArenaRegion.getSizeX() - x;
z = Config.ArenaRegion.getSizeZ() - z; z = Config.ArenaRegion.getSizeZ() - z;
}
double locX = x + Config.ArenaRegion.getMinX();
double locZ = z + Config.ArenaRegion.getMinZ(); double locZ = z + Config.ArenaRegion.getMinZ();
float pitch = source.readFloat(); float pitch = source.readFloat();
float yaw = source.readFloat() + (rotateZ ? 180 : 0); float yaw = source.readFloat() + (rotateZ ? 180 : 0);
@ -237,7 +240,7 @@ public class PacketProcessor {
private void entityVelocity() throws IOException { private void entityVelocity() throws IOException {
int entityId = source.readInt(); int entityId = source.readInt();
double dX = source.readDouble(); double dX = rotateZ ? -source.readDouble() : source.readDouble();
double dY = source.readDouble(); double dY = source.readDouble();
double dZ = rotateZ ? -source.readDouble() : source.readDouble(); double dZ = rotateZ ? -source.readDouble() : source.readDouble();
@ -306,8 +309,10 @@ public class PacketProcessor {
int z = Byte.toUnsignedInt(source.readByte()); int z = Byte.toUnsignedInt(source.readByte());
int blockState = source.readShort(); int blockState = source.readShort();
if(rotateZ) if(rotateZ) {
x = Config.ArenaRegion.getSizeX() - x;
z = Config.ArenaRegion.getSizeZ() - z; z = Config.ArenaRegion.getSizeZ() - z;
}
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState); 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 z = source.readInt() - arenaMinZ;
int blockState = source.readInt(); int blockState = source.readInt();
if(rotateZ) if(rotateZ) {
x = Config.ArenaRegion.getSizeX() - x;
z = Config.ArenaRegion.getSizeZ() - z; z = Config.ArenaRegion.getSizeZ() - z;
}
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState); 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 { private void particle() throws IOException {
double x = source.readDouble(); double x = source.readDouble() - arenaMinX;
double y = source.readDouble(); double y = source.readDouble() - arenaMinY;
double z = source.readDouble(); double z = source.readDouble() - arenaMinZ;
String particleName = source.readUTF(); 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 { 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 y = source.readInt() - arenaMinY + Config.BluePasteRegion.getMinY();
int rawZ = source.readInt() - arenaMinZ; int rawZ = source.readInt() - arenaMinZ;
if(rotateZ) if(rotateZ) {
rawX = Config.ArenaRegion.getSizeX() - rawX;
rawZ = Config.ArenaRegion.getSizeZ() - rawZ; rawZ = Config.ArenaRegion.getSizeZ() - rawZ;
}
int x = rawX + Config.ArenaRegion.getMinX();
int z = rawZ + Config.ArenaRegion.getMinZ(); int z = rawZ + Config.ArenaRegion.getMinZ();
String soundName = source.readUTF(); String soundName = source.readUTF();