For people referring to this in the future, Use these methods used in my case :
@Override
public SPacketUpdateTileEntity getUpdatePacket(){
NBTTagCompound nbtTag = new NBTTagCompound();
nbtTag.setTag("inventory", inventory.serializeNBT());
energy.writeToNBT(nbtTag);
nbtTag.setInteger("enchantTime", this.enchantTime);
nbtTag.setInteger("currentItemEnchantTime", this.currentItemEnchantTime);
nbtTag.setInteger("enchantingTime", this.enchantingTime);
nbtTag.setInteger("shouldEnchantTime", this.shouldEnchantTime);
nbtTag.setBoolean("isEnchanting", this.isEnchanting);
return new SPacketUpdateTileEntity(getPos(), 1, nbtTag);
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt){
NBTTagCompound tag = pkt.getNbtCompound();
inventory.deserializeNBT(tag.getCompoundTag("inventory"));
energy.readFromNBT(tag);
this.enchantTime = tag.getInteger("enchantTime");
this.currentItemEnchantTime = tag.getInteger("currentItemEnchantTime");
this.enchantingTime = tag.getInteger("enchantingTime");
this.shouldEnchantTime = tag.getInteger("shouldEnchantTime");
this.isEnchanting = tag.getBoolean("isEnchanting");
}
and also add the following in the update() method:
if(this.world.isBlockLoaded(getPos())) {
this.world.notifyBlockUpdate(getPos(), this.world.getBlockState(getPos()), this.world.getBlockState(getPos()), 2);
}
This should fix the problem I had