Fix rifts not rendering, fix rifts not closing, door blocks not synched

This commit is contained in:
CannibalVox 2015-03-09 03:36:56 -05:00
parent 4d26a2ec31
commit 76d2f20f5d
5 changed files with 32 additions and 29 deletions

View file

@ -140,7 +140,7 @@ public class CommonProxy implements IGuiHandler
int metadata = world.getBlockMetadata(x, y, z); int metadata = world.getBlockMetadata(x, y, z);
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata); 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); dimTile.lockStatus = door.getLockStatus(world, x, y, z);
} }
} }

View file

@ -90,26 +90,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
return false; return false;
} }
final int MAGIC_CONSTANT = 1003; int metadata = this.func_150012_g(world, x, y, z);
int newMetadata = metadata & 7;
int metadata = world.getBlockMetadata(x, y, z); newMetadata ^= 4;
int lowMeta = metadata & 7;
lowMeta ^= 4;
if (isUpperDoorBlock(metadata)) if ((metadata & 8) == 0)
{ {
world.setBlockMetadataWithNotify(x, y - 1, z, lowMeta, 2); world.setBlockMetadataWithNotify(x, y, z, newMetadata, 2);
world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
} }
else else
{ {
world.setBlockMetadataWithNotify(x, y, z, lowMeta, 2); world.setBlockMetadataWithNotify(x, y - 1, z, newMetadata, 2);
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z);
} }
world.playAuxSFXAtEntity(player, MAGIC_CONSTANT, x, y, z, 0); world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);
return true;
return true;
} }
@Override @Override
@ -129,7 +126,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{ {
if (side != 1 && side != 0) 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; int orientation = fullMetadata & 3;
boolean reversed = false; boolean reversed = false;
@ -246,7 +243,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
@Override @Override
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) 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));
} }

View file

@ -33,21 +33,27 @@ public class TileEntityDimDoor extends DDTileEntityBase
@Override @Override
public Packet getDescriptionPacket() public Packet getDescriptionPacket()
{ {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null) if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
{ {
ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)); ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj));
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound link = new NBTTagCompound();
linkData.writeToNBT(tag); linkData.writeToNBT(link);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); tag.setTag("Link", link);
} }
return null; return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
} }
@Override @Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
NBTTagCompound tag = pkt.func_148857_g(); NBTTagCompound tag = pkt.func_148857_g();
ClientLinkData linkData = ClientLinkData.readFromNBT(tag); readFromNBT(tag);
PocketManager.getLinkWatcher().onCreated(linkData);
if (tag.hasKey("Link")) {
ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link"));
PocketManager.getLinkWatcher().onCreated(linkData);
}
} }
@Override @Override

View file

@ -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); DimLink link = PocketManager.getLink(this.xCoord, this.yCoord, this.zCoord, worldObj);
if (link != null) if (link != null)

View file

@ -40,7 +40,7 @@ public class ClientProxy extends CommonProxy
int metadata = world.getBlockMetadata(x, y, z); int metadata = world.getBlockMetadata(x, y, z);
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata); 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); dimTile.lockStatus = door.getLockStatus(world, x, y, z);
} }
} }