Allow modifying of entity sacrificial values

Done via API or Config. API values take precedence over Config values.
This commit is contained in:
Nick 2016-01-19 19:46:49 -08:00
parent fa15499388
commit 073873960c
4 changed files with 79 additions and 13 deletions

View file

@ -15,9 +15,7 @@ import net.minecraftforge.oredict.OreDictionary;
import java.io.File;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
public class ConfigHandler
{
@ -36,6 +34,10 @@ public class ConfigHandler
// Well of Suffering Blacklist
public static List<String> wellOfSufferingBlacklist;
// Blood Altar Sacrificial Values
public static String[] entitySacrificeValuesList;
public static Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
// Potion ID's
public static int customPotionDrowningID;
public static int customPotionBoostID;
@ -120,6 +122,11 @@ public class ConfigHandler
config.addCustomCategoryComment(category, "Entity blacklisting from WoS");
wellOfSufferingBlacklist = Arrays.asList(config.getStringList("wellOfSufferingBlacklist", category, new String[] {}, "Use the class name of the Entity to blacklist it from usage.\nIE: EntityWolf, EntityWitch, etc"));
category = "Blood Altar Sacrificial Values";
config.addCustomCategoryComment(category, "Entity Sacrificial Value Settings");
entitySacrificeValuesList = config.getStringList("entitySacrificeValues", category, new String[] {"EntityVillager;2000", "EntitySlime;150", "EntityEnderman;200", "EntityCow;250", "EntityChicken;250", "EntityHorse;250", "EntitySheep;250", "EntityWolf;250", "EntityOcelot;250", "EntityPig;250", "EntityRabbit;250"}, "Used to edit the amount of LP gained per sacrifice of the given entity.\nSetting an entity to 0 effectively blacklists it.\nIf a mod modifies an entity via the API, it will take precedence over this config.\nSyntax: EntityClassName;LPPerSacrifice");
buildEntitySacrificeValues();
category = "Potions";
config.addCustomCategoryComment(category, "Potion settings");
config.addCustomCategoryComment(category + ".id", "Potion ID settings");
@ -224,6 +231,23 @@ public class ConfigHandler
}
}
private static void buildEntitySacrificeValues()
{
entitySacrificeValues.clear();
for (String entityData : entitySacrificeValuesList)
{
String[] split = entityData.split(";");
int amount = 500;
if (Utils.isInteger(split[1]))
amount = Integer.parseInt(split[1]);
if (!entitySacrificeValues.containsKey(split[0]))
entitySacrificeValues.put(split[0], amount);
}
}
public static void checkRituals()
{
RitualHelper.checkRituals(config, "WayofTime.bloodmagic.ritual", "Rituals");