minor tweaks throughout the source code

This commit is contained in:
asiekierka 2014-10-29 16:18:21 +01:00
parent 054524754d
commit eafa5fe859
6 changed files with 16 additions and 12 deletions

View file

@ -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());

View file

@ -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;
}

View file

@ -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);

View file

@ -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));
}
}

View file

@ -50,8 +50,6 @@ public class PacketUpdate extends BuildCraftPacket {
if (payload != null) {
payload.writeData(data);
} else {
data.writeByte(0);
}
}
@ -62,12 +60,14 @@ public class PacketUpdate extends BuildCraftPacket {
posY = data.readInt();
posZ = data.readInt();
if (data.isReadable()) {
payload = new PacketPayload();
if (payload != null) {
payload.readData(data);
}
}
}
@Override
public int getID() {

View file

@ -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();
}
}