2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.api.ritual;
|
2015-10-31 13:47:43 -07:00
|
|
|
|
2015-11-02 18:00:48 -08:00
|
|
|
import lombok.EqualsAndHashCode;
|
2015-10-31 13:47:43 -07:00
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
2015-12-29 13:00:26 -08:00
|
|
|
import lombok.ToString;
|
2015-10-31 13:47:43 -07:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-12-29 13:00:26 -08:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-10-31 17:58:47 -07:00
|
|
|
import net.minecraft.util.BlockPos;
|
2015-12-29 13:00:26 -08:00
|
|
|
import net.minecraft.world.World;
|
2015-10-31 13:47:43 -07:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* Abstract class for creating new rituals. Rituals need be registered with
|
|
|
|
* {@link WayofTime.bloodmagic.api.registry.RitualRegistry#registerRitual(Ritual, String)}
|
|
|
|
*/
|
2015-10-31 13:47:43 -07:00
|
|
|
@Getter
|
|
|
|
@RequiredArgsConstructor
|
2015-11-02 18:00:48 -08:00
|
|
|
@EqualsAndHashCode
|
2015-12-29 13:00:26 -08:00
|
|
|
@ToString
|
2015-10-31 17:58:47 -07:00
|
|
|
public abstract class Ritual {
|
2015-10-31 13:47:43 -07:00
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
|
2015-10-31 13:47:43 -07:00
|
|
|
private final String name;
|
|
|
|
private final int crystalLevel;
|
|
|
|
private final int activationCost;
|
|
|
|
private final RitualRenderer renderer;
|
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* @param name - The name of the ritual
|
|
|
|
* @param crystalLevel - Required Activation Crystal tier
|
|
|
|
* @param activationCost - Base LP cost for activating the ritual
|
|
|
|
*/
|
2015-10-31 17:58:47 -07:00
|
|
|
public Ritual(String name, int crystalLevel, int activationCost) {
|
|
|
|
this(name, crystalLevel, activationCost, null);
|
2015-10-31 13:47:43 -07:00
|
|
|
}
|
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2015-12-29 13:41:03 -05:00
|
|
|
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player) {
|
|
|
|
return true;
|
|
|
|
}
|
2015-10-31 17:58:47 -07:00
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2015-12-26 16:49:25 -08:00
|
|
|
public abstract void performRitual(IMasterRitualStone masterRitualStone);
|
2015-10-31 17:58:47 -07:00
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-12-29 13:41:03 -05:00
|
|
|
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType) {
|
|
|
|
|
|
|
|
}
|
2015-10-31 17:58:47 -07:00
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* Used to set the amount of LP drained every {@link #getRefreshTime()} ticks.
|
|
|
|
*
|
|
|
|
* @return - The amount of LP drained per refresh
|
|
|
|
*/
|
2015-10-31 17:58:47 -07:00
|
|
|
public abstract int getRefreshCost();
|
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-12-29 12:32:06 -08:00
|
|
|
public int getRefreshTime() {
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* @return a list of {@link RitualComponent} for checking the ritual.
|
|
|
|
*/
|
2015-10-31 17:58:47 -07:00
|
|
|
public abstract ArrayList<RitualComponent> getComponents();
|
|
|
|
|
|
|
|
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune) {
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset2, y, offset1), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset1, y, -offset2), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset2, y, offset1), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset1, y, offset2), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset2, y, -offset1), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset1, y, -offset2), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset2, y, -offset1), rune));
|
2015-10-31 13:47:43 -07:00
|
|
|
}
|
|
|
|
|
2015-10-31 17:58:47 -07:00
|
|
|
public void addCornerRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune) {
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset, y, offset), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset, y, -offset), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset, y, -offset), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset, y, offset), rune));
|
2015-10-31 13:47:43 -07:00
|
|
|
}
|
|
|
|
|
2015-10-31 17:58:47 -07:00
|
|
|
public void addParallelRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune) {
|
|
|
|
components.add(new RitualComponent(new BlockPos(offset, y, 0), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(-offset, y, 0), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(0, y, -offset), rune));
|
|
|
|
components.add(new RitualComponent(new BlockPos(0, y, offset), rune));
|
2015-10-31 13:47:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public enum BreakType {
|
|
|
|
REDSTONE,
|
|
|
|
BREAK_MRS,
|
|
|
|
BREAK_STONE,
|
|
|
|
ACTIVATE,
|
|
|
|
DEACTIVATE,
|
|
|
|
EXPLOSION,
|
|
|
|
}
|
|
|
|
}
|