From 34cb75dfc321a4807a771163a56227b26d311ada Mon Sep 17 00:00:00 2001 From: SquidDev Date: Mon, 1 May 2017 15:13:42 +0100 Subject: [PATCH] Fix various tile entities not syncing correctly This ensures the tile state is sent and received when it changes. This fixes turtles facing the wrong direction and computers not turning on. --- .../shared/common/TileGeneric.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java index 25175b97d..2e86ec148 100644 --- a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java +++ b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java @@ -65,9 +65,11 @@ public abstract class TileGeneric extends TileEntity public final void updateBlock() { + markDirty(); BlockPos pos = getPos(); + IBlockState state = worldObj.getBlockState( pos ); worldObj.markBlockRangeForRenderUpdate( pos, pos ); - worldObj.markChunkDirty( pos, this ); + worldObj.notifyBlockUpdate( getPos(), state, state, 3 ); } protected final void setBlockState( IBlockState newState ) @@ -208,4 +210,19 @@ public abstract class TileGeneric extends TileEntity } } } + + @Override + public NBTTagCompound getUpdateTag () + { + NBTTagCompound tag = super.getUpdateTag(); + writeDescription( tag ); + return tag; + } + + @Override + public void handleUpdateTag (NBTTagCompound tag) + { + super.handleUpdateTag(tag); + readDescription( tag ); + } }