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

44 lines
1,008 B
Java
Raw Normal View History

2015-12-27 19:38:12 -05:00
package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.base.TileTicking;
2015-12-27 19:38:12 -05:00
import net.minecraft.nbt.NBTTagCompound;
public class TilePhantomBlock extends TileTicking
{
private int ticksRemaining = 10;
2015-12-27 19:38:12 -05:00
public TilePhantomBlock() {
}
public TilePhantomBlock(int ticksRemaining)
{
this.ticksRemaining = ticksRemaining;
2015-12-27 19:38:12 -05:00
}
@Override
public void deserialize(NBTTagCompound tagCompound)
{
this.ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
2015-12-27 19:38:12 -05:00
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound)
{
2015-12-27 19:38:12 -05:00
tagCompound.setInteger(Constants.NBT.TICKS_REMAINING, ticksRemaining);
return tagCompound;
2015-12-27 19:38:12 -05:00
}
@Override
public void onUpdate()
{
2015-12-27 19:38:12 -05:00
ticksRemaining--;
if (ticksRemaining <= 0)
{
2016-12-12 19:56:36 -08:00
getWorld().setBlockToAir(getPos());
getWorld().removeTileEntity(getPos());
2015-12-27 19:38:12 -05:00
}
}
}