Fix zombievillager error in 1.8

This commit is contained in:
fullwall 2022-08-02 23:06:56 +08:00
parent 967fea021e
commit 3409b06b93

View File

@ -44,8 +44,16 @@ public class VillagerProfession extends Trait {
return;
if (npc.getEntity() instanceof Villager) {
((Villager) npc.getEntity()).setProfession(profession);
} else if (npc.getEntity() instanceof ZombieVillager) {
((ZombieVillager) npc.getEntity()).setVillagerProfession(profession);
return;
}
if (SUPPORT_ZOMBIE_VILLAGER) {
try {
if (npc.getEntity() instanceof ZombieVillager) {
((ZombieVillager) npc.getEntity()).setVillagerProfession(profession);
}
} catch (Throwable t) {
SUPPORT_ZOMBIE_VILLAGER = false;
}
}
}
@ -66,4 +74,6 @@ public class VillagerProfession extends Trait {
public String toString() {
return "Profession{" + profession + "}";
}
private static boolean SUPPORT_ZOMBIE_VILLAGER = true;
}