diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index d483517b..58242a7e 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -339,6 +339,7 @@ public class BuildCraftEnergy extends BuildCraftMod { @Mod.EventHandler public void postInit(FMLPostInitializationEvent evt) { + if (BuildCraftCore.modifyWorld) { MinecraftForge.EVENT_BUS.register(OilPopulate.INSTANCE); MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeInitializer()); diff --git a/common/buildcraft/builders/TileBlueprintLibrary.java b/common/buildcraft/builders/TileBlueprintLibrary.java index 59c6ebff..28b0b55a 100644 --- a/common/buildcraft/builders/TileBlueprintLibrary.java +++ b/common/buildcraft/builders/TileBlueprintLibrary.java @@ -239,7 +239,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory { @RPC (RPCSide.CLIENT) public void requestSelectedBlueprint () { - if (isOuputConsistent()) { + if (isOutputConsistent()) { if (selected > -1 && selected < currentPage.size()) { BlueprintBase bpt = BuildCraftBuilders.clientDB .load(currentPage.get(selected)); @@ -296,7 +296,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory { selected = index; } - private boolean isOuputConsistent () { + private boolean isOutputConsistent () { if (selected == -1 || getStackInSlot(2) == null) { return false; } diff --git a/common/buildcraft/core/network/PacketNBT.java b/common/buildcraft/core/network/PacketNBT.java index c5d6918f..90c815e8 100644 --- a/common/buildcraft/core/network/PacketNBT.java +++ b/common/buildcraft/core/network/PacketNBT.java @@ -10,8 +10,8 @@ package buildcraft.core.network; import java.io.IOException; +import buildcraft.api.core.BCLog; import io.netty.buffer.ByteBuf; - import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTTagCompound; @@ -34,6 +34,9 @@ public class PacketNBT extends PacketCoordinates { try { byte[] compressed = CompressedStreamTools.compress(nbttagcompound); + if (compressed.length > 65535) { + BCLog.logger.error("NBT data is too large (" + compressed.length + " > 65535)! Please report!"); + } data.writeShort(compressed.length); data.writeBytes(compressed); } catch (IOException e) { @@ -46,7 +49,7 @@ public class PacketNBT extends PacketCoordinates { public void readData(ByteBuf data) { super.readData(data); - short length = data.readShort(); + int length = data.readUnsignedShort(); byte[] compressed = new byte[length]; data.readBytes(compressed); diff --git a/common/buildcraft/core/network/PacketTileState.java b/common/buildcraft/core/network/PacketTileState.java index 9be5a4d1..ca41e20c 100644 --- a/common/buildcraft/core/network/PacketTileState.java +++ b/common/buildcraft/core/network/PacketTileState.java @@ -78,7 +78,7 @@ public class PacketTileState extends PacketCoordinates { stateWithId.state.writeData(tmpState); } - data.writeInt(tmpState.readableBytes()); + data.writeShort((short) tmpState.readableBytes()); data.writeBytes(tmpState.readBytes(tmpState.readableBytes())); } @@ -87,7 +87,7 @@ public class PacketTileState extends PacketCoordinates { super.readData(data); state = Unpooled.buffer(); - int length = data.readInt(); + int length = data.readUnsignedShort(); state.writeBytes(data.readBytes(length)); } } diff --git a/common/buildcraft/core/network/PacketUpdate.java b/common/buildcraft/core/network/PacketUpdate.java index 0a0c4743..7454c0a4 100644 --- a/common/buildcraft/core/network/PacketUpdate.java +++ b/common/buildcraft/core/network/PacketUpdate.java @@ -50,8 +50,6 @@ public class PacketUpdate extends BuildCraftPacket { if (payload != null) { payload.writeData(data); - } else { - data.writeByte(0); } } @@ -62,10 +60,12 @@ public class PacketUpdate extends BuildCraftPacket { posY = data.readInt(); posZ = data.readInt(); - payload = new PacketPayload(); + if (data.isReadable()) { + payload = new PacketPayload(); - if (payload != null) { - payload.readData(data); + if (payload != null) { + payload.readData(data); + } } } diff --git a/common/buildcraft/transport/network/PacketPowerUpdate.java b/common/buildcraft/transport/network/PacketPowerUpdate.java index 3c7b83a0..f9b08e36 100644 --- a/common/buildcraft/transport/network/PacketPowerUpdate.java +++ b/common/buildcraft/transport/network/PacketPowerUpdate.java @@ -32,7 +32,7 @@ public class PacketPowerUpdate extends PacketCoordinates { displayPower = new short[] { 0, 0, 0, 0, 0, 0 }; overload = data.readBoolean(); for (int i = 0; i < displayPower.length; i++) { - displayPower[i] = data.readByte(); + displayPower[i] = data.readUnsignedByte(); } }