From 8cbb57df977733cc6ee38755337679d9d50aaddc Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Sun, 23 Jul 2017 18:06:33 -0400 Subject: [PATCH] Fix herbalism I think --- .../config/experience/ExperienceConfig.java | 22 ++++++++++++++----- .../com/gmail/nossr50/util/StringUtils.java | 4 ++++ src/main/resources/experience.yml | 10 ++------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 53a3bb619..3112803f8 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -195,21 +195,31 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { public int getXp(SkillType skill, MaterialData data) { String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; - String explicitString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); - String noDataString = baseString + StringUtils.getPrettyItemString(data.getItemType()); + String explicitString = baseString + StringUtils.getExplicitConfigMaterialDataString(data); if (config.contains(explicitString)) return config.getInt(explicitString); - return config.getInt(noDataString, 0); + String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); + if (config.contains(friendlyString)) + return config.getInt(friendlyString); + String wildcardString = baseString + StringUtils.getWildcardConfigMaterialDataString(data); + if (config.contains(wildcardString)) + return config.getInt(wildcardString); + return 0; } public boolean isSkillBlock(SkillType skill, MaterialData data) { String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; - String explicitString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); - String noDataString = baseString + StringUtils.getPrettyItemString(data.getItemType()); + String explicitString = baseString + StringUtils.getExplicitConfigMaterialDataString(data); if (config.contains(explicitString)) return true; - return config.contains(noDataString); + String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); + if (config.contains(friendlyString)) + return true; + String wildcardString = baseString + StringUtils.getWildcardConfigMaterialDataString(data); + if (config.contains(wildcardString)) + return true; + return false; } /* Acrobatics */ diff --git a/src/main/java/com/gmail/nossr50/util/StringUtils.java b/src/main/java/com/gmail/nossr50/util/StringUtils.java index 280915e2f..15b9cf4e8 100644 --- a/src/main/java/com/gmail/nossr50/util/StringUtils.java +++ b/src/main/java/com/gmail/nossr50/util/StringUtils.java @@ -47,6 +47,10 @@ public class StringUtils { public static String getPrettyTreeSpeciesString(TreeSpecies species) { return createPrettyEnumString(species.toString()); } + + public static String getWildcardConfigMaterialDataString(MaterialData data) { + return StringUtils.getPrettyItemString(data.getItemType()).replace(" ", "_") + "|*"; + } public static String getFriendlyConfigMaterialDataString(MaterialData data) { switch (data.getItemType()) { diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index b36ab57d6..1bd9d2048 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -184,12 +184,6 @@ Experience: Water_Lily: 100 White_Tulip: 150 Yellow_Flower: 100 - Beetroot_Block_Ungrown: 0 - Carrot_Ungrown: 0 - Potato_Ungrown: 0 - Crops_Ungrown: 0 - Nether_Warts_Ungrown: 0 - Cocoa_Ungrown: 0 Mining: Coal_Ore: 100 Diamond_Ore: 750 @@ -208,8 +202,8 @@ Experience: Quartz_Ore: 100 Redstone_Ore: 150 Sandstone: 30 - Stained_Clay: 50 - Stone: 30 + Stained_Clay|*: 50 + Stone|*: 30 Red_Sandstone: 100 Prismarine: 70 Purpur_Block: 200