3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

SPIGOT-5647: ZombieVillager entity should have getVillagerType()

Dieser Commit ist enthalten in:
md_5 2020-03-30 12:15:21 +11:00
Ursprung 4d975ac3b7
Commit 95bd4238fb

Datei anzeigen

@ -11,6 +11,7 @@ import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Villager;
import org.bukkit.entity.ZombieVillager;
@ -47,6 +48,17 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
getHandle().setVillagerData(getHandle().getVillagerData().withProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT)))));
}
@Override
public Villager.Type getVillagerType() {
return Villager.Type.valueOf(IRegistry.VILLAGER_TYPE.getKey(getHandle().getVillagerData().getType()).getKey().toUpperCase(Locale.ROOT));
}
@Override
public void setVillagerType(Villager.Type type) {
Validate.notNull(type);
getHandle().setVillagerData(getHandle().getVillagerData().withType(IRegistry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))));
}
@Override
public boolean isConverting() {
return getHandle().isConverting();