From dc42c3020ed8ef5eff5a2fe4f22f78f8316d1b1a Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Sun, 29 Jun 2014 11:20:23 +0200 Subject: [PATCH] Fixed Server crashing when placing any container. Conflicts: build.gradle --- build.gradle | 2 +- .../tile/entity/TileEntityConnectable.java | 12 ++++++++---- .../tile/entity/TileEntityLockable.java | 9 ++++----- .../betterstorage/tile/entity/TileEntityLocker.java | 11 +++++------ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 6322ec30..6e314d9b 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -project.ext.mod_version = "0.9.1.104-dev" +project.ext.mod_version = "0.9.1.105-dev" project.ext.minecraft_version = "1.7.2" project.ext.forge_version = "10.12.2.1121" diff --git a/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityConnectable.java b/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityConnectable.java index ee794017..eecc0d63 100644 --- a/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityConnectable.java +++ b/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityConnectable.java @@ -220,13 +220,17 @@ public boolean isUseableByPlayer(EntityPlayer player) { // Tile entity synchronization - @Override - public Packet getDescriptionPacket() { - NBTTagCompound compound = new NBTTagCompound(); + public NBTTagCompound getDescriptionPacketData(NBTTagCompound compound) { compound.setByte("orientation", (byte)getOrientation().ordinal()); compound.setByte("connected", (byte)getConnected().ordinal()); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound); + return compound; } + + @Override + public Packet getDescriptionPacket() { + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, getDescriptionPacketData(new NBTTagCompound())); + } + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { NBTTagCompound compound = packet.func_148857_g(); diff --git a/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLockable.java b/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLockable.java index c9ccbbdc..ddc0f4c1 100644 --- a/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLockable.java +++ b/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLockable.java @@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.util.ForgeDirection; @@ -224,17 +223,17 @@ public void setPowered(boolean powered) { // TileEntity synchronization @Override - public Packet getDescriptionPacket() { - S35PacketUpdateTileEntity packet = (S35PacketUpdateTileEntity)super.getDescriptionPacket(); - NBTTagCompound compound = packet.func_148857_g(); + public NBTTagCompound getDescriptionPacketData(NBTTagCompound compound) { + compound = super.getDescriptionPacketData(compound); if (canHaveMaterial()) compound.setString(ContainerMaterial.TAG_NAME, getMaterial().name); if (canHaveLock()) { ItemStack lock = getLockInternal(); if (lock != null) compound.setTag("lock", lock.writeToNBT(new NBTTagCompound())); } - return packet; + return compound; } + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); diff --git a/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLocker.java b/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLocker.java index 20f66594..36730fc2 100644 --- a/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLocker.java +++ b/src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityLocker.java @@ -9,7 +9,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ResourceLocation; @@ -69,14 +68,14 @@ public boolean onBlockActivated(EntityPlayer player, int side, float hitX, float } // TileEntity synchronization - + @Override - public Packet getDescriptionPacket() { - S35PacketUpdateTileEntity packet = (S35PacketUpdateTileEntity)super.getDescriptionPacket(); - NBTTagCompound compound = packet.func_148857_g(); + public NBTTagCompound getDescriptionPacketData(NBTTagCompound compound) { + compound = super.getDescriptionPacketData(compound); compound.setBoolean("mirror", mirror); - return packet; + return compound; } + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet);