2015-12-27 19:38:12 -05:00
|
|
|
package WayofTime.bloodmagic.tile;
|
|
|
|
|
2018-02-15 18:49:01 -08:00
|
|
|
import WayofTime.bloodmagic.util.Constants;
|
2016-09-07 17:46:06 -07:00
|
|
|
import WayofTime.bloodmagic.tile.base.TileTicking;
|
2015-12-27 19:38:12 -05:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class TilePhantomBlock extends TileTicking {
|
2016-03-15 12:12:15 -07:00
|
|
|
private int ticksRemaining = 10;
|
2015-12-27 19:38:12 -05:00
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
public TilePhantomBlock() {
|
|
|
|
}
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public TilePhantomBlock(int ticksRemaining) {
|
2016-01-11 13:36:07 -08:00
|
|
|
this.ticksRemaining = ticksRemaining;
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public void deserialize(NBTTagCompound tagCompound) {
|
2016-01-11 13:36:07 -08:00
|
|
|
this.ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
|
2015-12-27 19:38:12 -05:00
|
|
|
tagCompound.setInteger(Constants.NBT.TICKS_REMAINING, ticksRemaining);
|
2016-05-19 17:43:33 -07:00
|
|
|
return tagCompound;
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public void onUpdate() {
|
2015-12-27 19:38:12 -05:00
|
|
|
ticksRemaining--;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|