Ensure all entity types function in experience.yml

Fixes #3443
This commit is contained in:
Glitchfinder 2018-05-16 08:07:07 -07:00
parent c83d011faa
commit e77801f3c1
2 changed files with 17 additions and 10 deletions

View File

@ -190,6 +190,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); } public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); } public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
/* Materials */ /* Materials */
public int getXp(SkillType skill, MaterialData data) public int getXp(SkillType skill, MaterialData data)

View File

@ -477,22 +477,28 @@ public final class CombatUtils {
else if (target instanceof Monster) else if (target instanceof Monster)
{ {
EntityType type = target.getType(); EntityType type = target.getType();
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
else {
EntityType type = target.getType();
if (type == EntityType.IRON_GOLEM) if (ExperienceConfig.getInstance().hasCombatXP(type)) {
{ if (type == EntityType.IRON_GOLEM)
if (!((IronGolem) target).isPlayerCreated()) { {
if (!((IronGolem) target).isPlayerCreated()) {
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
}
else
{
baseXP = ExperienceConfig.getInstance().getCombatXP(type); baseXP = ExperienceConfig.getInstance().getCombatXP(type);
} }
} }
else else
{ {
baseXP = ExperienceConfig.getInstance().getCombatXP(type); baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target);
} }
}
else {
baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target);
} }
if (target.hasMetadata(mcMMO.entityMetadataKey)) { if (target.hasMetadata(mcMMO.entityMetadataKey)) {