Imperfect rituals work mostly now
Just need to figure out an issue with the config
This commit is contained in:
parent
3a0dcae59a
commit
92bf7cc35b
15 changed files with 226 additions and 64 deletions
|
@ -1,15 +1,17 @@
|
|||
package WayofTime.bloodmagic.api.registry;
|
||||
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ImperfectRitualRegistry {
|
||||
|
||||
public static final BiMap<ImperfectRitual, Boolean> enabledRituals = HashBiMap.create();
|
||||
private static final BiMap<ImperfectRitual, Boolean> enabledRituals = HashBiMap.create();
|
||||
private static final BiMap<String, ImperfectRitual> registry = HashBiMap.create();
|
||||
|
||||
/**
|
||||
|
@ -27,6 +29,17 @@ public class ImperfectRitualRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
public static ImperfectRitual getRitualForBlock(BlockStack blockStack) {
|
||||
for (ImperfectRitual imperfectRitual : getRegistry().values()) {
|
||||
if (imperfectRitual.getRequiredBlock().equals(blockStack)) {
|
||||
System.out.println(imperfectRitual.toString());
|
||||
return imperfectRitual;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ImperfectRitual getRitualForId(String id) {
|
||||
return registry.get(id);
|
||||
}
|
||||
|
@ -44,13 +57,22 @@ public class ImperfectRitualRegistry {
|
|||
}
|
||||
|
||||
public static boolean ritualEnabled(ImperfectRitual imperfectRitual) {
|
||||
return enabledRituals.get(imperfectRitual);
|
||||
try {
|
||||
return enabledRituals.get(imperfectRitual);
|
||||
} catch (NullPointerException e) {
|
||||
BloodMagicAPI.getLogger().error("Invalid Imperfect Ritual was called");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static BiMap<String, ImperfectRitual> getRegistry() {
|
||||
return HashBiMap.create(registry);
|
||||
}
|
||||
|
||||
public static BiMap<ImperfectRitual, Boolean> getEnabledMap() {
|
||||
return HashBiMap.create(enabledRituals);
|
||||
}
|
||||
|
||||
public static ArrayList<String> getIds() {
|
||||
return new ArrayList<String>(registry.keySet());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue