BloodMagic/src/main/java/WayofTime/bloodmagic/tile/TilePhantomBlock.java

46 lines
1,017 B
Java
Raw Normal View History

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;
public class TilePhantomBlock extends TileEntity implements ITickable
{
2015-12-27 19:38:12 -05:00
private int ticksRemaining;
public TilePhantomBlock()
{
2015-12-27 19:38:12 -05:00
}
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{
2015-12-27 19:38:12 -05:00
super.readFromNBT(tagCompound);
ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
}
@Override
public void writeToNBT(NBTTagCompound tagCompound)
{
2015-12-27 19:38:12 -05:00
super.writeToNBT(tagCompound);
tagCompound.setInteger(Constants.NBT.TICKS_REMAINING, ticksRemaining);
}
@Override
public void update()
{
2015-12-27 19:38:12 -05:00
ticksRemaining--;
if (ticksRemaining <= 0)
{
2015-12-27 19:38:12 -05:00
worldObj.setBlockToAir(pos);
}
}
public void setDuration(int duration)
{
2015-12-27 19:38:12 -05:00
ticksRemaining = duration;
}
}