Exemple #1
0
 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;
 }
Exemple #2
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));
 }