Initial Work on Rituals

Added the framework for Rituals, including the automatic registration of rituals using the annotation.
This includes:
- The Master Ritual Stone
- The regular Ritual Stones (all 7 types)
- The Ritual Registration system
- The activation crystal items.
- Reintroduction of the Demon Will Aura (changed saved Dimension ID from Integer to ResourceLocation)

Localization needs to be completed, as well as the implementation of all the rituals.
This commit is contained in:
WayofTime 2020-10-24 14:50:25 -04:00
parent 0a9717f1ed
commit 1f0dcb608a
61 changed files with 3943 additions and 26 deletions

View file

@ -0,0 +1,71 @@
package wayoftime.bloodmagic.tile.base;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.nbt.CompoundNBT;
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 ITickable
{
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;
}
}