Ritual docs

This commit is contained in:
Nick 2015-12-29 13:00:26 -08:00
parent 1c8d6d6986
commit 5774703c0d
6 changed files with 89 additions and 0 deletions

View file

@ -6,6 +6,11 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
/**
* This interface is for internal implementation only.
*
* It is provided via the API for easy obtaining of basic data.
*/
public interface IMasterRitualStone {
String getOwner();

View file

@ -3,6 +3,11 @@ package WayofTime.bloodmagic.api.ritual;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
* This interface is for internal implementation only.
*
* It is provided via the API for easy obtaining of basic data.
*/
public interface IRitualStone {
boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType);

View file

@ -3,14 +3,22 @@ package WayofTime.bloodmagic.api.ritual;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
/**
* Abstract class for creating new rituals. Rituals need be registered with
* {@link WayofTime.bloodmagic.api.registry.RitualRegistry#registerRitual(Ritual, String)}
*/
@Getter
@RequiredArgsConstructor
@EqualsAndHashCode
@ToString
public abstract class Ritual {
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
@ -19,26 +27,69 @@ public abstract class Ritual {
private final int activationCost;
private final RitualRenderer renderer;
/**
* @param name - The name of the ritual
* @param crystalLevel - Required Activation Crystal tier
* @param activationCost - Base LP cost for activating the ritual
*/
public Ritual(String name, int crystalLevel, int activationCost) {
this(name, crystalLevel, activationCost, null);
}
/**
* Called when the player attempts to activate the ritual.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
*
* @param masterRitualStone - The {@link IMasterRitualStone} that the ritual is bound to
* @param player - The activating player
* @return - Whether activation was successful
*/
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player) {
return true;
}
/**
* Called every {@link #getRefreshTime()} ticks while active.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
*
* @param masterRitualStone - The {@link IMasterRitualStone} that the ritual is bound to
*/
public abstract void performRitual(IMasterRitualStone masterRitualStone);
/**
* Called when the ritual is stopped for a given {@link BreakType}.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(BreakType)}
*
* @param masterRitualStone - The {@link IMasterRitualStone} that the ritual is bound to
* @param breakType - The type of break that caused the stoppage.
*/
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType) {
}
/**
* Used to set the amount of LP drained every {@link #getRefreshTime()} ticks.
*
* @return - The amount of LP drained per refresh
*/
public abstract int getRefreshCost();
/**
* Used to set the refresh rate of the ritual. (How often {@link #performRitual(IMasterRitualStone)}
* is called.
*
* @return - How often to perform the effect in ticks.
*/
public int getRefreshTime() {
return 20;
}
/**
* @return a list of {@link RitualComponent} for checking the ritual.
*/
public abstract ArrayList<RitualComponent> getComponents();
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune) {

View file

@ -5,6 +5,10 @@ import lombok.RequiredArgsConstructor;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
/**
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos}
* for usage in Ritual creation.
*/
@Getter
@RequiredArgsConstructor
public class RitualComponent {

View file

@ -4,6 +4,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
* This interface is for internal implementation only.
*
* It is provided via the API for easy obtaining of basic data.
*/
public interface IImperfectRitualStone {
boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player);

View file

@ -5,7 +5,13 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
* Abstract class for creating new imperfect rituals. ImperfectRituals need be registered with
* {@link WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry#registerRitual(ImperfectRitual)}
*/
@RequiredArgsConstructor
@Getter
@EqualsAndHashCode
@ -16,10 +22,23 @@ public abstract class ImperfectRitual {
private final int activationCost;
private final boolean lightshow;
/**
* @param name - The name of the ritual
* @param requiredBlock - The block required above the ImperfectRitualStone
* @param activationCost - Base LP cost for activating the ritual
*/
public ImperfectRitual(String name, BlockStack requiredBlock, int activationCost) {
this(name, requiredBlock, activationCost, false);
}
/**
* Called when the player activates the ritual
* {@link WayofTime.bloodmagic.tile.TileImperfectRitualStone#performRitual(World, BlockPos, ImperfectRitual, EntityPlayer)}
*
* @param imperfectRitualStone - The {@link IImperfectRitualStone} that the ritual is bound to
* @param player - The player activating the ritual
* @return - Whether activation was successful
*/
public abstract boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player);
@Override