Fix Tile data syncing (#763)
This commit is contained in:
parent
bdf540aa76
commit
a37cf7d60b
|
@ -1,6 +1,8 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
@ -69,4 +71,25 @@ public class TileBloodTank extends TileEntity implements IFluidHandler
|
|||
tagCompound.setInteger("capacity", capacity);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
return new SPacketUpdateTileEntity(getPos(), -999, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
|
||||
{
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,4 +218,10 @@ public class TileDemonCrystal extends TileEntity implements ITickable
|
|||
readFromNBT(pkt.getNbtCompound());
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
}
|
|
@ -109,6 +109,12 @@ public class TileInventory extends TileEntity implements IInventory
|
|||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
||||
{
|
||||
|
|
|
@ -289,6 +289,12 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
|
|||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorldObj()
|
||||
{
|
||||
|
|
|
@ -64,6 +64,12 @@ public class TilePhantomBlock extends TileEntity implements ITickable
|
|||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.google.common.base.Strings;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -42,6 +44,27 @@ public class TileSpectralBlock extends TileEntity implements ITickable
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
return new SPacketUpdateTileEntity(getPos(), -999, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
|
||||
{
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue