Attempt to try to fix the 1.16.3's branch having multiple 'wayoftime' folders.
This commit is contained in:
parent
c159828248
commit
6b4145a67c
224 changed files with 0 additions and 24047 deletions
|
@ -1,71 +0,0 @@
|
|||
package wayoftime.bloodmagic.tile.base;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
||||
/**
|
||||
* Base class for tiles that tick. Allows disabling the ticking
|
||||
* programmatically.
|
||||
*/
|
||||
// TODO - Move implementations that depend on existed ticks to new methods from here.
|
||||
public abstract class TileTicking extends TileBase implements ITickableTileEntity
|
||||
{
|
||||
private int ticksExisted;
|
||||
private boolean shouldTick = true;
|
||||
|
||||
public TileTicking(TileEntityType<?> type)
|
||||
{
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void tick()
|
||||
{
|
||||
if (shouldTick())
|
||||
{
|
||||
ticksExisted++;
|
||||
onUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void deserializeBase(CompoundNBT tagCompound)
|
||||
{
|
||||
this.ticksExisted = tagCompound.getInt("ticksExisted");
|
||||
this.shouldTick = tagCompound.getBoolean("shouldTick");
|
||||
}
|
||||
|
||||
@Override
|
||||
CompoundNBT serializeBase(CompoundNBT tagCompound)
|
||||
{
|
||||
tagCompound.putInt("ticksExisted", getTicksExisted());
|
||||
tagCompound.putBoolean("shouldTick", shouldTick());
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called every tick that {@link #shouldTick()} is true.
|
||||
*/
|
||||
public abstract void onUpdate();
|
||||
|
||||
public int getTicksExisted()
|
||||
{
|
||||
return ticksExisted;
|
||||
}
|
||||
|
||||
public void resetLifetime()
|
||||
{
|
||||
ticksExisted = 0;
|
||||
}
|
||||
|
||||
public boolean shouldTick()
|
||||
{
|
||||
return shouldTick;
|
||||
}
|
||||
|
||||
public void setShouldTick(boolean shouldTick)
|
||||
{
|
||||
this.shouldTick = shouldTick;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue