mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 20:30:28 +01:00
Add setTarget and getTarget to Slime.
This commit is contained in:
parent
fb414fe101
commit
3a482bdd40
@ -4,6 +4,7 @@ import net.minecraft.server.EntitySlime;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Slime;
|
||||
|
||||
public class CraftSlime extends CraftLivingEntity implements Slime {
|
||||
@ -20,6 +21,20 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
|
||||
getHandle().setSize(size, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTarget(LivingEntity target) {
|
||||
if (target == null) {
|
||||
getHandle().setGoalTarget(null, null, false);
|
||||
} else if (target instanceof CraftLivingEntity) {
|
||||
getHandle().setGoalTarget(((CraftLivingEntity) target).getHandle(), null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getTarget() {
|
||||
return getHandle().getGoalTarget() == null ? null : (LivingEntity)getHandle().getGoalTarget().getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySlime getHandle() {
|
||||
return (EntitySlime) entity;
|
||||
|
Loading…
Reference in New Issue
Block a user