mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
Added Creature.setTarget per jlogsdon
By: James Logsdon <dwarf@girsbrain.org>
This commit is contained in:
parent
0788f8e7d0
commit
64354406fc
1 changed files with 19 additions and 1 deletions
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue