package com.zivilon.cinder_loe.tileentity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityShadowTile extends TileEntity { public long spawnTime; public static long REMOVAL_DELAY_MS = 15000; @Override public void updateEntity() { if (!worldObj.isRemote) { if (spawnTime == 0) { spawnTime = System.currentTimeMillis(); } long currentTime = System.currentTimeMillis(); if (currentTime >= spawnTime + REMOVAL_DELAY_MS) { worldObj.setBlockToAir(xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); // Force the client to update worldObj.removeTileEntity(xCoord, yCoord, zCoord); // Clean up the tile entity } } } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("spawnTime", spawnTime); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); spawnTime = nbt.getLong("spawnTime"); } }