public static boolean isAIDisabled(Entity entity) { net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle(); if (!(nmsEntity instanceof EntityInsentient)) return true; return nmsEntity.getDataWatcher().getByte(15) != 0; }
public static void toggleAI(Entity entity, boolean hasAI) { net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle(); if (!(nmsEntity instanceof EntityInsentient)) return; nmsEntity.getDataWatcher().watch(15, (byte) (hasAI ? 0 : 1)); }