@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()); }
@Override public void bn() { if (npc == null) super.bn(); else { NMS.updateAI(this); npc.update(); } }
@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. }
@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); }
@Override public void bl() { super.bl(); if (npc != null) npc.update(); }