예제 #1
0
  public void b(int i0) {
    super.b(i0);
    Collection collection = this.cr().a(ScoreObjectiveCriteria.f);
    Iterator iterator = collection.iterator();

    while (iterator.hasNext()) {
      ScoreObjective scoreobjective = (ScoreObjective) iterator.next();

      this.cr().a(this.am(), scoreobjective).a(Arrays.asList(new EntityPlayer[] {this}));
    }
  }
  @Override
  public void b(EntityHuman entity) {
    if (lastTargetId == -1 || lastTargetId != entity.id) {
      EntityTargetEvent event =
          new NpcEntityTargetEvent(
              getBukkitEntity(),
              entity.getBukkitEntity(),
              NpcEntityTargetEvent.NpcTargetReason.CLOSEST_PLAYER);
      CraftServer server = ((WorldServer) this.world).getServer();
      server.getPluginManager().callEvent(event);
    }
    lastTargetId = entity.id;

    super.b(entity);
  }
예제 #3
0
 protected void b(PotionEffect potioneffect) {
   super.b(potioneffect);
   this.a.b(new Packet41EntityEffect(this.k, potioneffect));
 }
예제 #4
0
  public void g() {
    try {
      super.l_();

      for (int i0 = 0; i0 < this.bK.j_(); ++i0) {
        ItemStack itemstack = this.bK.a(i0);

        if (itemstack != null && Item.f[itemstack.c].f() && this.a.e() <= 5) {
          Packet packet = ((ItemMapBase) Item.f[itemstack.c]).c(itemstack, this.q, this);

          if (packet != null) {
            this.a.b(packet);
          }
        }
      }

      // CanaryMod: HealthChange / HealthEnabled
      if (this.aX() != this.cm && cm != -99999999 && this.getPlayer() != null) {
        // updates your health when it is changed.
        if (!Configuration.getWorldConfig(getCanaryWorld().getFqName()).isHealthEnabled()) {
          super.b(this.aW());
          this.M = false;
        } else {
          HealthChangeHook hook = new HealthChangeHook(getPlayer(), cm, this.aX());

          Canary.hooks().callHook(hook);
          if (hook.isCanceled()) {
            super.b(this.cm);
          }
        }
      }
      //

      if (this.aX() != this.cm || this.cn != this.bN.a() || this.bN.e() == 0.0F != this.co) {
        // CanaryMod: convert health for values above 20
        int health = (int) (this.aX() / (this.aW() / 20));

        health = (this.aX() > 0 && health == 0) ? 1 : health;
        this.a.b(new Packet8UpdateHealth(health, this.bN.a(), this.bN.e()));
        //
        this.cm = this.aX();
        this.cn = this.bN.a();
        this.co = this.bN.e() == 0.0F;
      }

      if (this.cg != this.cp) {
        // CanaryMod: ExperienceHook / ExperienceEnabled
        if (!Configuration.getWorldConfig(getCanaryWorld().getFqName()).isExperienceEnabled()) {
          this.cg = 0;
          this.cf = 0;
        } else if (getPlayer() != null) { // NPC?
          ExperienceHook hook = new ExperienceHook(getPlayer(), this.cp, cg);

          if (!hook.isCanceled()) {
            this.cp = this.cg;
            this.a.b(new Packet43Experience(this.ch, this.cg, this.cf));
          }
        }
        //
      }
    } catch (Throwable throwable) {
      CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
      CrashReportCategory crashreportcategory = crashreport.a("Player being ticked");

      this.a(crashreportcategory);
      throw new ReportedException(crashreport);
    }
  }
예제 #5
0
 public void b(NBTTagCompound nbttagcompound) {
   super.b(nbttagcompound);
   nbttagcompound.a("playerGameType", this.c.b().a());
 }