From 6067e54dd23803b340e22650df56940fbd0e7ba3 Mon Sep 17 00:00:00 2001 From: Redrield Date: Sat, 26 Mar 2016 01:42:27 -0400 Subject: [PATCH] SPIGOT-213: Add method to enable / disable AI for mobs --- .../bukkit/craftbukkit/entity/CraftLivingEntity.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index ad3917de7e..81afb917dc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -528,4 +528,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public AttributeInstance getAttribute(Attribute attribute) { return getHandle().craftAttributes.getAttribute(attribute); } + + @Override + public void setAI(boolean ai) { + if (this.getHandle() instanceof EntityInsentient) { + ((EntityInsentient) this.getHandle()).m(!ai); // PAIL: rename + } + } + + @Override + public boolean hasAI() { + return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).cR() : false; // PAIL: rename + } }