mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
SPIGOT-5647: ZombieVillager entity should have getVillagerType()
This commit is contained in:
parent
4d975ac3b7
commit
95bd4238fb
1 changed files with 12 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue