2015-12-27 19:38:12 -05:00
|
|
|
package WayofTime.bloodmagic.tile;
|
|
|
|
|
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.util.ITickable;
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public class TilePhantomBlock extends TileEntity implements ITickable
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
private int ticksRemaining;
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public TilePhantomBlock()
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public void readFromNBT(NBTTagCompound tagCompound)
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
super.readFromNBT(tagCompound);
|
|
|
|
ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public void writeToNBT(NBTTagCompound tagCompound)
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
super.writeToNBT(tagCompound);
|
|
|
|
tagCompound.setInteger(Constants.NBT.TICKS_REMAINING, ticksRemaining);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public void update()
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
ticksRemaining--;
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
if (ticksRemaining <= 0)
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
worldObj.setBlockToAir(pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public void setDuration(int duration)
|
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
ticksRemaining = duration;
|
|
|
|
}
|
|
|
|
}
|