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.
This commit is contained in:
SquidDev 2017-05-01 15:13:42 +01:00
parent 43d68db349
commit 34cb75dfc3
1 changed files with 18 additions and 1 deletions

View File

@ -65,9 +65,11 @@ protected final IBlockState getBlockState()
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 final void onDataPacket( NetworkManager net, SPacketUpdateTileEntity pack
}
}
}
@Override
public NBTTagCompound getUpdateTag ()
{
NBTTagCompound tag = super.getUpdateTag();
writeDescription( tag );
return tag;
}
@Override
public void handleUpdateTag (NBTTagCompound tag)
{
super.handleUpdateTag(tag);
readDescription( tag );
}
}