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,7 +477,12 @@ 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 (ExperienceConfig.getInstance().hasCombatXP(type)) {
if (type == EntityType.IRON_GOLEM) if (type == EntityType.IRON_GOLEM)
{ {
if (!((IronGolem) target).isPlayerCreated()) { if (!((IronGolem) target).isPlayerCreated()) {
@ -488,12 +493,13 @@ public final class CombatUtils {
{ {
baseXP = ExperienceConfig.getInstance().getCombatXP(type); baseXP = ExperienceConfig.getInstance().getCombatXP(type);
} }
} }
else { else
{
baseXP = 1.0; baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target); mcMMO.getModManager().addCustomEntity(target);
} }
}
if (target.hasMetadata(mcMMO.entityMetadataKey)) { if (target.hasMetadata(mcMMO.entityMetadataKey)) {
baseXP *= ExperienceConfig.getInstance().getSpawnedMobXpMultiplier(); baseXP *= ExperienceConfig.getInstance().getSpawnedMobXpMultiplier();