Make tile entity updating not send null packets causing console spam

This commit is contained in:
Ellpeck 2016-05-12 19:37:31 +02:00
parent 3ad6b1c7cb
commit dcd41a016a
2 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -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));
}
}
}