Implement API for Skeleton and Zombie types. Fixes BUKKIT-2818

This commit is contained in:
James Clarke 2012-11-05 18:09:40 +00:00 committed by Travis Watkins
parent dca54ff187
commit bd0868ae1e
3 changed files with 27 additions and 1 deletions

View File

@ -61,7 +61,7 @@ public class EntityZombie extends EntityMonster {
}
public void setBaby(boolean flag) {
this.getDataWatcher().watch(12, Byte.valueOf((byte) 1));
this.getDataWatcher().watch(12, Byte.valueOf((byte) (flag ? 1 : 0))); // CraftBukkit - added flag
}
public boolean isVillager() {

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySkeleton;
import org.apache.commons.lang.Validate;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
@ -25,4 +26,13 @@ public class CraftSkeleton extends CraftMonster implements Skeleton {
public EntityType getType() {
return EntityType.SKELETON;
}
public SkeletonType getSkeletonType() {
return SkeletonType.getType(getHandle().getSkeletonType());
}
public void setSkeletonType(SkeletonType type) {
Validate.notNull(type);
getHandle().setSkeletonType(type.getId());
}
}

View File

@ -25,4 +25,20 @@ public class CraftZombie extends CraftMonster implements Zombie {
public EntityType getType() {
return EntityType.ZOMBIE;
}
public boolean isBaby() {
return getHandle().isBaby();
}
public void setBaby(boolean flag) {
getHandle().setBaby(flag);
}
public boolean isVillager() {
return getHandle().isVillager();
}
public void setVillager(boolean flag) {
getHandle().setVillager(flag);
}
}