Exemple #1
0
 public static void setShouldJump(org.bukkit.entity.Entity entity) {
   Entity handle = getHandle(entity);
   if (handle instanceof EntityInsentient) {
     ControllerJump controller = ((EntityInsentient) handle).getControllerJump();
     controller.a();
   } else if (handle instanceof EntityHumanNPC) {
     ((EntityHumanNPC) handle).setShouldJump();
   }
 }
Exemple #2
0
 public static void look(Entity handle, Entity target) {
   if (handle instanceof EntityInsentient) {
     ((EntityInsentient) handle)
         .getControllerLook()
         .a(target, 10.0F, ((EntityInsentient) handle).bQ());
   } else if (handle instanceof EntityHumanNPC) {
     ((EntityHumanNPC) handle).setTargetLook(target, 10F, 40F);
   }
 }
Exemple #3
0
 public static void setDestination(
     org.bukkit.entity.Entity entity, double x, double y, double z, float speed) {
   Entity handle = ((CraftEntity) entity).getHandle();
   if (handle instanceof EntityInsentient) {
     ((EntityInsentient) handle).getControllerMove().a(x, y, z, speed);
   } else if (handle instanceof EntityHumanNPC) {
     ((EntityHumanNPC) handle).setMoveDestination(x, y, z, speed);
   }
 }
Exemple #4
0
 public static void updateAI(EntityLiving entity) {
   if (entity instanceof EntityInsentient) {
     EntityInsentient handle = (EntityInsentient) entity;
     handle.getEntitySenses().a();
     NMS.updateNavigation(handle.getNavigation());
     handle.getControllerMove().c();
     handle.getControllerLook().a();
     handle.getControllerJump().b();
   } else if (entity instanceof EntityHumanNPC) {
     ((EntityHumanNPC) entity).updateAI();
   }
 }
Exemple #5
0
 public static void updatePathfindingRange(NPC npc, float pathfindingRange) {
   if (!npc.isSpawned() || !npc.getEntity().getType().isAlive()) return;
   EntityLiving en = NMS.getHandle((LivingEntity) npc.getEntity());
   if (!(en instanceof EntityInsentient)) {
     if (en instanceof EntityHumanNPC) {
       ((EntityHumanNPC) en).updatePathfindingRange(pathfindingRange);
     }
     return;
   }
   if (PATHFINDING_RANGE == null) return;
   EntityInsentient handle = (EntityInsentient) en;
   NavigationAbstract navigation = handle.getNavigation();
   try {
     AttributeInstance inst = (AttributeInstance) PATHFINDING_RANGE.get(navigation);
     inst.setValue(pathfindingRange);
   } catch (IllegalArgumentException e) {
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   }
 }