diff options
author | Senmori <thesenmori@gmail.com> | 2018-02-26 20:52:09 -0500 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-03-03 21:50:57 +1100 |
commit | 3a482bdd40088d78a838a16ed7c9064342aa8acd (patch) | |
tree | 055e18a21ea5aaeb4e6809324b441b6d6432a9df | |
parent | fb414fe101c10ff159d5cbec148a4d3f27ff990d (diff) | |
download | craftbukkit-3a482bdd40088d78a838a16ed7c9064342aa8acd.tar craftbukkit-3a482bdd40088d78a838a16ed7c9064342aa8acd.tar.gz craftbukkit-3a482bdd40088d78a838a16ed7c9064342aa8acd.tar.lz craftbukkit-3a482bdd40088d78a838a16ed7c9064342aa8acd.tar.xz craftbukkit-3a482bdd40088d78a838a16ed7c9064342aa8acd.zip |
Add setTarget and getTarget to Slime.
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index b29749fa..6bf30c83 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -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 { @@ -21,6 +22,20 @@ public class CraftSlime extends CraftLivingEntity implements Slime { } @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; } |