Fix Tile data syncing (#763)
This commit is contained in:
parent
bdf540aa76
commit
a37cf7d60b
6 changed files with 70 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package WayofTime.bloodmagic.tile;
|
package WayofTime.bloodmagic.tile;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
|
@ -69,4 +71,25 @@ public class TileBloodTank extends TileEntity implements IFluidHandler
|
||||||
tagCompound.setInteger("capacity", capacity);
|
tagCompound.setInteger("capacity", capacity);
|
||||||
return tagCompound;
|
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());
|
readFromNBT(pkt.getNbtCompound());
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
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());
|
readFromNBT(pkt.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getUpdateTag()
|
||||||
|
{
|
||||||
|
return writeToNBT(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
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());
|
readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getUpdateTag()
|
||||||
|
{
|
||||||
|
return writeToNBT(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getWorldObj()
|
public World getWorldObj()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,12 @@ public class TilePhantomBlock extends TileEntity implements ITickable
|
||||||
readFromNBT(pkt.getNbtCompound());
|
readFromNBT(pkt.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getUpdateTag()
|
||||||
|
{
|
||||||
|
return writeToNBT(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
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.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -42,6 +44,27 @@ public class TileSpectralBlock extends TileEntity implements ITickable
|
||||||
return tagCompound;
|
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
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue