Ejemplo n.º 1
0
  public void a(float f0) {
    // CanaryMod: FoodExhaustionHook
    FoodExhaustionHook exh =
        new FoodExhaustionHook(
            ((EntityPlayerMP) entityplayer).getPlayer(), this.c, Math.min(this.c + f0, 40.0F));

    Canary.hooks().callHook(exh);
    this.c = exh.getNewValue();
    //
  }
Ejemplo n.º 2
0
  public void a(EntityPlayer entityplayer) {
    int i0 = entityplayer.q.r;

    this.e = this.a;
    if (this.c > 4.0F) {
      // CanaryMod: FoodExhaustionHook
      FoodExhaustionHook exh =
          new FoodExhaustionHook(
              ((EntityPlayerMP) entityplayer).getPlayer(), this.c, this.c - 4.0F);

      Canary.hooks().callHook(exh);
      this.c = exh.getNewValue();
      //
      if (this.b > 0.0F) {
        // CanaryMod: FoodSaturationHook
        FoodSaturationHook sat =
            new FoodSaturationHook(
                ((EntityPlayerMP) entityplayer).getPlayer(), this.b, Math.max(this.b - 1.0F, 0.0F));

        Canary.hooks().callHook(sat);
        this.b = Math.max(Math.min(sat.getNewValue(), (float) this.a), 0.0F);
        //
      } else if (i0 > 0) {
        // CanaryMod: FoodLevelHook
        FoodLevelHook lvl =
            new FoodLevelHook(
                ((EntityPlayerMP) entityplayer).getPlayer(), this.a, Math.max(this.a - 1, 0));

        Canary.hooks().callHook(lvl);
        this.a = Math.max(Math.min(lvl.getNewValue(), 20), 0);
        //
      }
    }

    if (this.a >= 18 && entityplayer.cm()) {
      ++this.d;
      if (this.d >= 80) {
        entityplayer.j(1);
        this.d = 0;
      }
    } else if (this.a <= 0) {
      ++this.d;
      if (this.d >= 80) {
        if (entityplayer.aX() > 10 || i0 >= 3 || entityplayer.aX() > 1 && i0 >= 2) {
          // CanaryMod: DamageHook (starve)
          DamageHook dmg =
              new DamageHook(
                  null, entityplayer.getCanaryEntity(), new CanaryDamageSource(DamageSource.f), 1);

          Canary.hooks().callHook(dmg);
          if (!dmg.isCanceled()) {
            entityplayer.a(
                (((CanaryDamageSource) dmg.getDamageSource()).getHandle()), dmg.getDamageDealt());
          }
          //
        }

        this.d = 0;
      }
    } else {
      this.d = 0;
    }
  }