Better map Zombie/Villager professions.

This commit is contained in:
md_5 2016-06-09 12:20:30 +10:00
parent a8a4bedd2a
commit 8b94601269
2 changed files with 3 additions and 3 deletions

View File

@ -39,12 +39,13 @@ public class CraftVillager extends CraftAgeable implements Villager, InventoryHo
} }
public Profession getProfession() { public Profession getProfession() {
return Profession.values()[getHandle().getProfession()]; return Profession.values()[getHandle().getProfession() + 1]; // Offset by 1 from the zombie types
} }
public void setProfession(Profession profession) { public void setProfession(Profession profession) {
Validate.notNull(profession); Validate.notNull(profession);
getHandle().setProfession(profession.ordinal()); Validate.isTrue(0 < profession.ordinal() && profession.ordinal() < Profession.HUSK.ordinal(), "This profession is reserved for Zombies: ", profession);
getHandle().setProfession(profession.ordinal() - 1);
} }
@Override @Override

View File

@ -51,7 +51,6 @@ public class CraftZombie extends CraftMonster implements Zombie {
@Override @Override
public Villager.Profession getVillagerProfession() { public Villager.Profession getVillagerProfession() {
if (!isVillager()) return Villager.Profession.NORMAL;
return Villager.Profession.values()[getHandle().getVillagerType().ordinal()]; return Villager.Profession.values()[getHandle().getVillagerType().ordinal()];
} }
} }