2015-12-27 19:38:12 -05:00
|
|
|
package WayofTime.bloodmagic.tile;
|
|
|
|
|
2016-03-17 13:00:44 -07:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2016-09-07 17:46:06 -07:00
|
|
|
import WayofTime.bloodmagic.tile.base.TileTicking;
|
2016-03-15 12:12:15 -07:00
|
|
|
import lombok.NoArgsConstructor;
|
2015-12-27 19:38:12 -05:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
2016-03-15 12:12:15 -07:00
|
|
|
@NoArgsConstructor
|
2016-09-07 17:46:06 -07:00
|
|
|
public class TilePhantomBlock extends TileTicking
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2016-03-15 12:12:15 -07:00
|
|
|
private int ticksRemaining = 10;
|
2015-12-27 19:38:12 -05:00
|
|
|
|
2016-01-11 13:36:07 -08:00
|
|
|
public TilePhantomBlock(int ticksRemaining)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2016-01-11 13:36:07 -08:00
|
|
|
this.ticksRemaining = ticksRemaining;
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-09-07 17:46:06 -07:00
|
|
|
public void deserialize(NBTTagCompound tagCompound)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
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
|
2016-09-07 17:46:06 -07:00
|
|
|
public NBTTagCompound serialize(NBTTagCompound tagCompound)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
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
|
2016-09-07 17:46:06 -07:00
|
|
|
public void onUpdate()
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2015-12-27 19:38:12 -05:00
|
|
|
ticksRemaining--;
|
|
|
|
|
2015-12-30 15:34:40 -05: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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|