From 64354406fc650632b270cfe5f8954c91f1cdc731 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot <noreply+git-craftbukkit@papermc.io> Date: Thu, 3 Feb 2011 18:17:53 -0500 Subject: [PATCH] Added Creature.setTarget per jlogsdon By: James Logsdon <dwarf@girsbrain.org> --- .../craftbukkit/entity/CraftCreature.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 24b8b22761..09e15c13db 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -1,18 +1,36 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityCreature; +import net.minecraft.server.EntityLiving; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Creature; +import org.bukkit.entity.LivingEntity; public class CraftCreature extends CraftLivingEntity implements Creature{ + private EntityCreature entity; public CraftCreature(CraftServer server, EntityCreature entity) { super(server, entity); + this.entity = entity; + } + + public void setTarget(LivingEntity target) { + if (target == null) { + entity.d = null; + } else if (target instanceof CraftLivingEntity) { + EntityLiving victim = ((CraftLivingEntity)target).getHandle(); + entity.d = victim; + entity.a = entity.world.a(entity, entity.d, 16.0F); + } + } + + @Override + public EntityCreature getHandle() { + return entity; } @Override public String toString() { return "CraftCreature"; } - }