SteamWar/FightSystem
Archiviert
13
1

Fix SGEU replay
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 16:58:01 +02:00
Ursprung 6941cc98f0
Commit 4531816792
2 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -32,6 +32,9 @@ public class BlockIdWrapper8 implements BlockIdWrapper {
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void setBlock(World world, int x, int y, int z, int blockState) { public void setBlock(World world, int x, int y, int z, int blockState) {
if((blockState >> 4) > 256) // Illegal blockstate / corrupted replay
blockState = 0;
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false); world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
} }

Datei anzeigen

@ -45,6 +45,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import java.io.EOFException; import java.io.EOFException;
import java.io.FilterInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
@ -217,7 +218,11 @@ public class PacketProcessor {
float yaw = source.readFloat() + (rotateZ ? 180 : 0); float yaw = source.readFloat() + (rotateZ ? 180 : 0);
byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256); byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256);
execSync(() -> REntity.getEntity(entityId).move(locX, locY, locZ, pitch, yaw, headYaw)); execSync(() -> {
REntity entity = REntity.getEntity(entityId);
if(entity != null)
entity.move(locX, locY, locZ, pitch, yaw, headYaw);
});
} }
private void entityDespawns() throws IOException { private void entityDespawns() throws IOException {
@ -410,7 +415,12 @@ public class PacketProcessor {
private void pasteEmbeddedSchem(FightTeam team) throws IOException { private void pasteEmbeddedSchem(FightTeam team) throws IOException {
int schemId = source.readInt(); int schemId = source.readInt();
Clipboard clipboard = SchematicNode.clipboardFromStream(source, Core.getVersion() > 12); Clipboard clipboard = SchematicNode.clipboardFromStream(new FilterInputStream(source) {
@Override
public void close() {
// FAWE 1.12 calls close...
}
}, Core.getVersion() > 12);
execSync(() -> team.pasteSchem(schemId, clipboard)); execSync(() -> team.pasteSchem(schemId, clipboard));
} }