Fix Sigil of the Phantom Bridge
I'm tentatively considering this fixed. I'd rather not do it this way, but it seems to work...
This commit is contained in:
parent
0d70eb359e
commit
9950b32d53
3 changed files with 39 additions and 29 deletions
|
@ -1,23 +1,30 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TilePhantomBlock extends TileEntity implements ITickable
|
||||
{
|
||||
private int ticksRemaining;
|
||||
|
||||
public TilePhantomBlock()
|
||||
public TilePhantomBlock(int ticksRemaining)
|
||||
{
|
||||
this.ticksRemaining = ticksRemaining;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
|
||||
this.ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,12 +41,29 @@ public class TilePhantomBlock extends TileEntity implements ITickable
|
|||
|
||||
if (ticksRemaining <= 0)
|
||||
{
|
||||
worldObj.setBlockToAir(pos);
|
||||
worldObj.removeTileEntity(getPos());
|
||||
worldObj.setBlockToAir(getPos());
|
||||
}
|
||||
}
|
||||
|
||||
public void setDuration(int duration)
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
ticksRemaining = duration;
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(getPos(), -999, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
|
||||
{
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
||||
{
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue