Skip to content

Commit

Permalink
Fixed Server crashing when placing any container.
Browse files Browse the repository at this point in the history
Conflicts:
	build.gradle
  • Loading branch information
Victorious3 committed Jun 29, 2014
1 parent 2d1b89a commit dc42c30
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dc42c30

Please sign in to comment.