From dcd41a016a43735ca18ef97337427d74c6fc7795 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 12 May 2016 19:37:31 +0200 Subject: [PATCH] Make tile entity updating not send null packets causing console spam --- .../mod/network/PacketUpdateTileEntity.java | 6 +++--- .../ellpeck/actuallyadditions/mod/tile/TileEntityBase.java | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java index b3cab5ce3..c69f908dc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java @@ -35,9 +35,9 @@ public class PacketUpdateTileEntity implements IMessage{ } - public PacketUpdateTileEntity(TileEntityBase tile){ - this.compound = tile.getSyncCompound(); - this.pos = tile.getPos(); + public PacketUpdateTileEntity(NBTTagCompound compound, BlockPos pos){ + this.compound = compound; + this.pos = pos; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 8c062e476..ec736bee7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -176,6 +176,9 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } public final void sendUpdate(){ - PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); + NBTTagCompound compound = this.getSyncCompound(); + if(compound != null){ + PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(compound, this.getPos()), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); + } } } \ No newline at end of file