package com.yolp900.itsjustacharm.common.tileEntities; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import javax.annotation.Nonnull; import javax.annotation.Nullable; public abstract class ModTileEntity extends TileEntity { @Override @Nonnull public NBTTagCompound getUpdateTag() { NBTTagCompound tag = new NBTTagCompound(); this.writeToNBT(tag); return tag; } @Override @Nullable public SPacketUpdateTileEntity getUpdatePacket() { return new SPacketUpdateTileEntity(this.pos, 0, getUpdateTag()); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { NBTTagCompound tag = pkt.getNbtCompound(); this.readFromNBT(tag); } }