Implemented the Ritual Diviner and added its recipe. Added unlocalized name to rituals. Removed a few unnecessary imports.
This commit is contained in:
parent
c815960f5e
commit
98ca2fbd16
12 changed files with 553 additions and 88 deletions
src/main/java/WayofTime/bloodmagic/api
|
@ -1,18 +1,21 @@
|
|||
package WayofTime.bloodmagic.api.registry;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
public class RitualRegistry {
|
||||
|
||||
public static final Map<Ritual, Boolean> enabledRituals = new HashMap<Ritual, Boolean>();
|
||||
private static final BiMap<String, Ritual> registry = HashBiMap.create();
|
||||
// Ordered list for actions that depend on the order that the rituals were registered in
|
||||
private static final ArrayList<String> orderedIdList = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* The safe way to register a new Ritual.
|
||||
|
@ -24,8 +27,10 @@ public class RitualRegistry {
|
|||
if (ritual != null) {
|
||||
if (registry.containsKey(id))
|
||||
BloodMagicAPI.getLogger().error("Duplicate ritual id: %s", id);
|
||||
else
|
||||
else {
|
||||
registry.put(id, ritual);
|
||||
orderedIdList.add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +70,10 @@ public class RitualRegistry {
|
|||
public static ArrayList<String> getIds() {
|
||||
return new ArrayList<String>(registry.keySet());
|
||||
}
|
||||
|
||||
public static ArrayList<String> getOrderedIds() {
|
||||
return orderedIdList;
|
||||
}
|
||||
|
||||
public static ArrayList<Ritual> getRituals() {
|
||||
return new ArrayList<Ritual>(registry.values());
|
||||
|
|
|
@ -26,14 +26,15 @@ public abstract class Ritual {
|
|||
private final int crystalLevel;
|
||||
private final int activationCost;
|
||||
private final RitualRenderer renderer;
|
||||
private final String unlocalizedName;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
public Ritual(String name, int crystalLevel, int activationCost, String unlocalizedName) {
|
||||
this(name, crystalLevel, activationCost, null, unlocalizedName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,10 +14,10 @@ import net.minecraftforge.common.config.Configuration;
|
|||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
|
||||
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.IRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||
import WayofTime.bloodmagic.block.BlockRitualStone;
|
||||
|
||||
public class RitualHelper {
|
||||
|
||||
|
@ -84,8 +84,8 @@ public class RitualHelper {
|
|||
BlockPos newPos = pos.add(component.getOffset(direction));
|
||||
IBlockState worldState = world.getBlockState(newPos);
|
||||
Block block = worldState.getBlock();
|
||||
if (block instanceof BlockRitualStone) {
|
||||
if(!((BlockRitualStone)block).isRuneType(world, newPos, component.getRuneType())) {
|
||||
if (block instanceof IRitualStone) {
|
||||
if(!((IRitualStone)block).isRuneType(world, newPos, component.getRuneType())) {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue