예제 #1
0
 @Override
 public void collide(net.minecraft.server.v1_4_6.Entity entity) {
   // this method is called by both the entities involved - cancelling
   // it will not stop the NPC from moving.
   super.collide(entity);
   if (npc != null) Util.callCollisionEvent(npc, entity.getBukkitEntity());
 }
예제 #2
0
 @Override
 public void bn() {
   if (npc == null) super.bn();
   else {
     NMS.updateAI(this);
     npc.update();
   }
 }
예제 #3
0
 @Override
 public void g(double x, double y, double z) {
   if (npc == null) {
     super.g(x, y, z);
     return;
   }
   if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
     if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) super.g(x, y, z);
     return;
   }
   Vector vector = new Vector(x, y, z);
   NPCPushEvent event = Util.callPushEvent(npc, vector);
   if (!event.isCancelled()) {
     vector = event.getCollisionVector();
     super.g(vector.getX(), vector.getY(), vector.getZ());
   }
   // when another entity collides, this method is called to push the
   // NPC so we prevent it from doing anything if the event is
   // cancelled.
 }
예제 #4
0
 @Override
 protected void bn() {
   if (owner == null) {
     super.bn();
     return;
   }
   this.getNavigation().a(((CraftPlayer) owner).getHandle(), 0.7F);
   this.getNavigation().e(); // this is only needed for old ai
   getControllerMove().c();
   getControllerLook().a();
   getControllerJump().b();
   if (distToOwner() > Util.MAX_DISTANCE) this.getBukkitEntity().teleport(owner);
 }
예제 #5
0
 @Override
 public void bl() {
   super.bl();
   if (npc != null) npc.update();
 }