diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java b/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java index 73b28e82..9a1666d3 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java @@ -140,7 +140,7 @@ public class CommonProxy implements IGuiHandler int metadata = world.getBlockMetadata(x, y, z); TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata); - dimTile.orientation = world.getBlockMetadata(x,y,z) & 7; + dimTile.orientation = door.func_150012_g(world, x,y,z) & 7; dimTile.lockStatus = door.getLockStatus(world, x, y, z); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java index 7d84b108..5178dd38 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java @@ -90,26 +90,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn return false; } - final int MAGIC_CONSTANT = 1003; - - int metadata = world.getBlockMetadata(x, y, z); - int lowMeta = metadata & 7; - lowMeta ^= 4; + int metadata = this.func_150012_g(world, x, y, z); + int newMetadata = metadata & 7; + newMetadata ^= 4; - if (isUpperDoorBlock(metadata)) - { - world.setBlockMetadataWithNotify(x, y - 1, z, lowMeta, 2); - world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); - } - else - { - world.setBlockMetadataWithNotify(x, y, z, lowMeta, 2); - world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); - } + if ((metadata & 8) == 0) + { + world.setBlockMetadataWithNotify(x, y, z, newMetadata, 2); + world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + } + else + { + world.setBlockMetadataWithNotify(x, y - 1, z, newMetadata, 2); + world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); + } - world.playAuxSFXAtEntity(player, MAGIC_CONSTANT, x, y, z, 0); - - return true; + world.playAuxSFXAtEntity(player, 1003, x, y, z, 0); + return true; } @Override @@ -129,7 +126,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn { if (side != 1 && side != 0) { - int fullMetadata = blockAccess.getBlockMetadata(x, y, z); + int fullMetadata = func_150012_g(blockAccess, x, y, z); int orientation = fullMetadata & 3; boolean reversed = false; @@ -246,7 +243,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn @Override public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { - this.setDoorRotation(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + this.setDoorRotation(func_150012_g(par1IBlockAccess, par2, par3, par4)); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java index d2800661..8a488089 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java @@ -33,21 +33,27 @@ public class TileEntityDimDoor extends DDTileEntityBase @Override public Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null) { ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)); - NBTTagCompound tag = new NBTTagCompound(); - linkData.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); + NBTTagCompound link = new NBTTagCompound(); + linkData.writeToNBT(link); + tag.setTag("Link", link); } - return null; + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { NBTTagCompound tag = pkt.func_148857_g(); - ClientLinkData linkData = ClientLinkData.readFromNBT(tag); - PocketManager.getLinkWatcher().onCreated(linkData); + readFromNBT(tag); + + if (tag.hasKey("Link")) { + ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link")); + PocketManager.getLinkWatcher().onCreated(linkData); + } } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java index 54b1fc0a..63993c9d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java @@ -164,7 +164,7 @@ public class TileEntityRift extends DDTileEntityBase } } } - if (growth == 0 && !worldObj.isRemote) + if (growth <= 0 && !worldObj.isRemote) { DimLink link = PocketManager.getLink(this.xCoord, this.yCoord, this.zCoord, worldObj); if (link != null) diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java index feefd279..9387b13f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java @@ -40,7 +40,7 @@ public class ClientProxy extends CommonProxy int metadata = world.getBlockMetadata(x, y, z); TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata); - dimTile.orientation = world.getBlockMetadata(x, y, z) & 7; + dimTile.orientation = door.func_150012_g(world, x, y, z) & 7; dimTile.lockStatus = door.getLockStatus(world, x, y, z); } }