This commit is contained in:
simibubi 2021-04-15 22:03:25 +02:00
parent 3dfe67cd1e
commit db3c296792

View file

@ -385,11 +385,10 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
CompoundNBT compound = new CompoundNBT(); CompoundNBT compound = new CompoundNBT();
writeAdditional(compound, true); writeAdditional(compound, true);
byte[] byteArray = null;
try { try {
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(); ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
CompressedStreamTools.write(compound, dataOutput); CompressedStreamTools.write(compound, dataOutput);
byteArray = dataOutput.toByteArray(); byte[] byteArray = dataOutput.toByteArray();
int estimatedPacketSize = byteArray.length; int estimatedPacketSize = byteArray.length;
if (estimatedPacketSize > 2_000_000) { if (estimatedPacketSize > 2_000_000) {
Create.logger.warn("Could not send Contraption Spawn Data (Packet too big): " Create.logger.warn("Could not send Contraption Spawn Data (Packet too big): "
@ -404,7 +403,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
return; return;
} }
buffer.writeByteArray(byteArray); buffer.writeCompoundTag(compound);
} }
@Override @Override