@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());
 }
Example #2
0
  @Override
  public void c(Entity entity) {
    if (lastBounceId != entity.id || System.currentTimeMillis() - lastBounceTick > 1000) {
      EntityTargetEvent event =
          new NpcEntityTargetEvent(
              getBukkitEntity(),
              entity.getBukkitEntity(),
              NpcEntityTargetEvent.NpcTargetReason.NPC_BOUNCED);
      CraftServer server = ((WorldServer) world).getServer();
      server.getPluginManager().callEvent(event);

      lastBounceTick = System.currentTimeMillis();
    }

    lastBounceId = entity.id;

    super.c(entity);
  }