Fix herbalism I think

This commit is contained in:
t00thpick1 2017-07-23 18:06:33 -04:00
parent 2c8d2998bb
commit 8cbb57df97
3 changed files with 22 additions and 14 deletions

View File

@ -195,21 +195,31 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public int getXp(SkillType skill, MaterialData data) public int getXp(SkillType skill, MaterialData data)
{ {
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); String explicitString = baseString + StringUtils.getExplicitConfigMaterialDataString(data);
String noDataString = baseString + StringUtils.getPrettyItemString(data.getItemType());
if (config.contains(explicitString)) if (config.contains(explicitString))
return config.getInt(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) public boolean isSkillBlock(SkillType skill, MaterialData data)
{ {
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); String explicitString = baseString + StringUtils.getExplicitConfigMaterialDataString(data);
String noDataString = baseString + StringUtils.getPrettyItemString(data.getItemType());
if (config.contains(explicitString)) if (config.contains(explicitString))
return true; 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 */ /* Acrobatics */

View File

@ -48,6 +48,10 @@ public class StringUtils {
return createPrettyEnumString(species.toString()); return createPrettyEnumString(species.toString());
} }
public static String getWildcardConfigMaterialDataString(MaterialData data) {
return StringUtils.getPrettyItemString(data.getItemType()).replace(" ", "_") + "|*";
}
public static String getFriendlyConfigMaterialDataString(MaterialData data) { public static String getFriendlyConfigMaterialDataString(MaterialData data) {
switch (data.getItemType()) { switch (data.getItemType()) {
case LOG : case LOG :

View File

@ -184,12 +184,6 @@ Experience:
Water_Lily: 100 Water_Lily: 100
White_Tulip: 150 White_Tulip: 150
Yellow_Flower: 100 Yellow_Flower: 100
Beetroot_Block_Ungrown: 0
Carrot_Ungrown: 0
Potato_Ungrown: 0
Crops_Ungrown: 0
Nether_Warts_Ungrown: 0
Cocoa_Ungrown: 0
Mining: Mining:
Coal_Ore: 100 Coal_Ore: 100
Diamond_Ore: 750 Diamond_Ore: 750
@ -208,8 +202,8 @@ Experience:
Quartz_Ore: 100 Quartz_Ore: 100
Redstone_Ore: 150 Redstone_Ore: 150
Sandstone: 30 Sandstone: 30
Stained_Clay: 50 Stained_Clay|*: 50
Stone: 30 Stone|*: 30
Red_Sandstone: 100 Red_Sandstone: 100
Prismarine: 70 Prismarine: 70
Purpur_Block: 200 Purpur_Block: 200