SteamWar/FightSystem
Archiviert
13
1

Support new world height in replays
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-10-07 17:23:00 +02:00
Ursprung 4531816792
Commit 9d4df5b715
2 geänderte Dateien mit 20 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -100,12 +100,13 @@ public class PacketProcessor {
packetDecoder[0x0b] = this::damage;
packetDecoder[0x0c] = this::fireTick;
packetDecoder[0x20] = this::arenaInfo;
packetDecoder[0x30] = this::block;
packetDecoder[0x30] = this::byteWorldHeightBlock;
packetDecoder[0x31] = this::particle;
packetDecoder[0x32] = this::sound;
packetDecoder[0x33] = this::shortBlock;
packetDecoder[0x34] = this::soundAtPlayer;
packetDecoder[0x35] = this::shortRelativeBlock;
packetDecoder[0x36] = this::block;
packetDecoder[0xa0] = () -> send(ChatMessageType.CHAT);
packetDecoder[0xa1] = () -> send(ChatMessageType.ACTION_BAR);
packetDecoder[0xa2] = () -> send(ChatMessageType.SYSTEM);
@ -335,7 +336,7 @@ public class PacketProcessor {
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
}
private void block() throws IOException {
private void byteWorldHeightBlock() throws IOException {
int x = source.readInt() - arenaMinX;
int y = Byte.toUnsignedInt(source.readByte()) - arenaMinY;
int z = source.readInt() - arenaMinZ;
@ -349,6 +350,20 @@ public class PacketProcessor {
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
}
private void block() throws IOException {
int x = source.readInt() - arenaMinX;
int y = source.readShort() - arenaMinY;
int z = source.readInt() - arenaMinZ;
int blockState = source.readInt();
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);
}
private void setBlock(int x, int y, int z, int blockState){
if(!Config.ArenaRegion.in2dRegion(x, z))
return; //Outside of the arena

Datei anzeigen

@ -99,12 +99,13 @@ public interface Recorder {
*
* ArenaInfo (0x20) + bool blueNegZ + byte arenaY + int arenaMinX + int arenaMinZ
*
* BlockPacket (0x30) + pos int, byte, int + int BlockState
* DEPRECATED BlockPacket (0x30) + pos int, byte, int + int BlockState
* ParticlePacket (0x31) + double x, y, z + string particleType
* SoundPacket (0x32) + int x, y, z + string soundType + string soundCategory + float volume, pitch
* DEPRECATED ShortBlockPacket (0x33) + pos relative to ArenaMinX,ArenaMinZ byte, byte, byte + short BlockState
* SoundAtPlayerPacket (0x34) + string (soundType, soundCategory) + float volume, pitch
* ShortBlockPacket (0x35) + pos relative to ArenaMinX,BluePasteY,ArenaMinZ byte, byte, byte + short BlockState
* BlockPacket (0x36) + pos int, short, int + int BlockState
*
*
* DEPRECATED ChatPacket (0xa0) + String message
@ -226,7 +227,7 @@ public interface Recorder {
write(0x35, (byte)shortX, (byte)shortY, (byte)shortZ, (short)blockState);
}else{
//Block packet
write(0x30, block.getX(), (byte)block.getY(), block.getZ(), blockState);
write(0x36, block.getX(), (short)block.getY(), block.getZ(), blockState);
}
}