diff options
author | md_5 <git@md-5.net> | 2016-06-09 12:20:30 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-06-09 12:20:30 +1000 |
commit | 8b94601269ba634b81cd1aac8cad5d84572dae71 (patch) | |
tree | 07ea038a50d9582dd6e724d7db97f853c290ba75 /src/main/java/org/bukkit | |
parent | a8a4bedd2a9ef3c192ecf76db9afaf0b784ed08d (diff) | |
download | craftbukkit-8b94601269ba634b81cd1aac8cad5d84572dae71.tar craftbukkit-8b94601269ba634b81cd1aac8cad5d84572dae71.tar.gz craftbukkit-8b94601269ba634b81cd1aac8cad5d84572dae71.tar.lz craftbukkit-8b94601269ba634b81cd1aac8cad5d84572dae71.tar.xz craftbukkit-8b94601269ba634b81cd1aac8cad5d84572dae71.zip |
Better map Zombie/Villager professions.
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java | 5 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 04919b2c..5fcf81c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 3e1fc532..ebae86f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -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()]; } } |