mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 03:17:36 +01:00
Better map Zombie/Villager professions.
This commit is contained in:
parent
a8a4bedd2a
commit
8b94601269
@ -39,12 +39,13 @@ public class CraftVillager extends CraftAgeable implements Villager, InventoryHo
|
||||
}
|
||||
|
||||
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) {
|
||||
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
|
||||
|
@ -51,7 +51,6 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
||||
|
||||
@Override
|
||||
public Villager.Profession getVillagerProfession() {
|
||||
if (!isVillager()) return Villager.Profession.NORMAL;
|
||||
return Villager.Profession.values()[getHandle().getVillagerType().ordinal()];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user