@Override
  protected void a(float paramFloat) {
    int i = (int) Math.ceil(paramFloat - 3.0F);
    if (i > 0) {
      // CanaryMod Damage hook: Falling
      if (!(Boolean)
          manager.callHook(PluginLoader.Hook.DAMAGE, PluginLoader.DamageType.FALL, null, entity, i))
        a((OEntity) null, i);

      int j = aH.a(OMathHelper.b(aL), OMathHelper.b(aK - 0.2D - be), OMathHelper.b(aN));
      if (j > 0) {
        OStepSound localOStepSound = OBlock.m[j].bw;
        aH.a(this, localOStepSound.c(), localOStepSound.a() * 0.5F, localOStepSound.b() * 0.75F);
      }
    }
  }
  public OEntityThrowable(OWorld oworld, OEntityLiving oentityliving) {
    super(oworld);
    this.g = oentityliving;
    this.a(0.25F, 0.25F);
    this.b(
        oentityliving.u,
        oentityliving.v + (double) oentityliving.e(),
        oentityliving.w,
        oentityliving.A,
        oentityliving.B);
    this.u -= (double) (OMathHelper.b(this.A / 180.0F * 3.1415927F) * 0.16F);
    this.v -= 0.10000000149011612D;
    this.w -= (double) (OMathHelper.a(this.A / 180.0F * 3.1415927F) * 0.16F);
    this.b(this.u, this.v, this.w);
    this.N = 0.0F;
    float f = 0.4F;

    this.x =
        (double)
            (-OMathHelper.a(this.A / 180.0F * 3.1415927F)
                * OMathHelper.b(this.B / 180.0F * 3.1415927F)
                * f);
    this.z =
        (double)
            (OMathHelper.b(this.A / 180.0F * 3.1415927F)
                * OMathHelper.b(this.B / 180.0F * 3.1415927F)
                * f);
    this.y = (double) (-OMathHelper.a((this.B + this.d()) / 180.0F * 3.1415927F) * f);
    this.c(this.x, this.y, this.z, this.c(), 1.0F);
  }
  public void c(double d0, double d1, double d2, float f, float f1) {
    float f2 = OMathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);

    d0 /= (double) f2;
    d1 /= (double) f2;
    d2 /= (double) f2;
    d0 += this.ab.nextGaussian() * 0.007499999832361937D * (double) f1;
    d1 += this.ab.nextGaussian() * 0.007499999832361937D * (double) f1;
    d2 += this.ab.nextGaussian() * 0.007499999832361937D * (double) f1;
    d0 *= (double) f;
    d1 *= (double) f;
    d2 *= (double) f;
    this.x = d0;
    this.y = d1;
    this.z = d2;
    float f3 = OMathHelper.a(d0 * d0 + d2 * d2);

    this.C = this.A = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
    this.D = this.B = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
    this.i = 0;
  }
  public void a(OEntity paramOEntity, int paramInt, double paramDouble1, double paramDouble2) {
    float f1 = OMathHelper.a(paramDouble1 * paramDouble1 + paramDouble2 * paramDouble2);
    float f2 = 0.4F;

    aO /= 2.0D;
    aP /= 2.0D;
    aQ /= 2.0D;

    aO -= paramDouble1 / f1 * f2;
    aP += 0.4D;
    aQ -= paramDouble2 / f1 * f2;

    if (aP > 0.4D) aP = 0.4D;
  }
  public void a(OEntity paramOEntity, int paramInt, double paramDouble1, double paramDouble2) {
    float f1 = OMathHelper.a(paramDouble1 * paramDouble1 + paramDouble2 * paramDouble2);
    float f2 = 0.4F;

    aN /= 2.0D;
    aO /= 2.0D;
    aP /= 2.0D;

    aN -= paramDouble1 / f1 * f2;
    aO += 0.4000000059604645D;
    aP -= paramDouble2 / f1 * f2;

    if (aO > 0.4000000059604645D) aO = 0.4000000059604645D;
  }
  @Override
  public void p_() {
    super.p_();

    u();

    double d1 = aL - aI;
    double d2 = aN - aK;

    float f1 = OMathHelper.a(d1 * d1 + d2 * d2);

    float f2 = G;

    float f3 = 0.0F;
    I = J;
    float f4 = 0.0F;
    if (f1 > 0.05F) {
      f4 = 1.0F;
      f3 = f1 * 3.0F;
      f2 = (float) Math.atan2(d2, d1) * 180.0F / 3.141593F - 90.0F;
    }
    if (W > 0.0F) f2 = aR;
    if (!aW) f4 = 0.0F;
    J += (f4 - J) * 0.3F;

    float f5 = f2 - G;
    while (f5 < -180.0F) f5 += 360.0F;
    while (f5 >= 180.0F) f5 -= 360.0F;
    G += f5 * 0.3F;

    float f6 = aR - G;
    while (f6 < -180.0F) f6 += 360.0F;
    while (f6 >= 180.0F) f6 -= 360.0F;
    int i = (f6 < -90.0F) || (f6 >= 90.0F) ? 1 : 0;
    if (f6 < -75.0F) f6 = -75.0F;
    if (f6 >= 75.0F) f6 = 75.0F;
    G = (aR - f6);
    if (f6 * f6 > 2500.0F) G += f6 * 0.2F;

    if (i != 0) f3 *= -1.0F;
    while (aR - aT < -180.0F) aT -= 360.0F;
    while (aR - aT >= 180.0F) aT += 360.0F;
    while (G - H < -180.0F) H -= 360.0F;
    while (G - H >= 180.0F) H += 360.0F;
    while (aS - aU < -180.0F) aU -= 360.0F;
    while (aS - aU >= 180.0F) aU += 360.0F;
    K += f3;
  }
  @Override
  public void f_() {
    super.f_();

    r();

    double d1 = aK - aH;
    double d2 = aM - aJ;

    float f1 = OMathHelper.a(d1 * d1 + d2 * d2);

    float f2 = F;

    float f3 = 0.0F;
    H = I;
    float f4 = 0.0F;
    if (f1 > 0.05F) {
      f4 = 1.0F;
      f3 = f1 * 3.0F;
      f2 = (float) Math.atan2(d2, d1) * 180.0F / 3.141593F - 90.0F;
    }
    if (V > 0.0F) f2 = aQ;
    if (!aV) f4 = 0.0F;
    I += (f4 - I) * 0.3F;

    float f5 = f2 - F;
    while (f5 < -180.0F) f5 += 360.0F;
    while (f5 >= 180.0F) f5 -= 360.0F;
    F += f5 * 0.3F;

    float f6 = aQ - F;
    while (f6 < -180.0F) f6 += 360.0F;
    while (f6 >= 180.0F) f6 -= 360.0F;
    int i = (f6 < -90.0F) || (f6 >= 90.0F) ? 1 : 0;
    if (f6 < -75.0F) f6 = -75.0F;
    if (f6 >= 75.0F) f6 = 75.0F;
    F = (aQ - f6);
    if (f6 * f6 > 2500.0F) F += f6 * 0.2F;

    if (i != 0) f3 *= -1.0F;
    while (aQ - aS < -180.0F) aS -= 360.0F;
    while (aQ - aS >= 180.0F) aS += 360.0F;
    while (F - G < -180.0F) G -= 360.0F;
    while (F - G >= 180.0F) G += 360.0F;
    while (aR - aT < -180.0F) aT -= 360.0F;
    while (aR - aT >= 180.0F) aT += 360.0F;
    J += f3;
  }
  public void a(OEntity paramOEntity, float paramFloat1, float paramFloat2) {
    double d1 = paramOEntity.aL - aL;

    double d2 = paramOEntity.aN - aN;
    double d3;
    if ((paramOEntity instanceof OEntityLiving)) {
      OEntityLiving localOEntityLiving = (OEntityLiving) paramOEntity;
      d3 = aM + s() - (localOEntityLiving.aM + localOEntityLiving.s());
    } else d3 = (paramOEntity.aV.b + paramOEntity.aV.e) / 2.0D - (aM + s());

    double d4 = OMathHelper.a(d1 * d1 + d2 * d2);

    float f1 = (float) (Math.atan2(d2, d1) * 180.0D / 3.141592741012573D) - 90.0F;
    float f2 = (float) (-(Math.atan2(d3, d4) * 180.0D / 3.141592741012573D));
    aS = (-b(aS, f2, paramFloat2));
    aR = b(aR, f1, paramFloat1);
  }
  public void a(OEntity paramOEntity, float paramFloat1, float paramFloat2) {
    double d1 = paramOEntity.aK - aK;

    double d2 = paramOEntity.aM - aM;
    double d3;
    if ((paramOEntity instanceof OEntityLiving)) {
      OEntityLiving localOEntityLiving = (OEntityLiving) paramOEntity;
      d3 = aL + q() - (localOEntityLiving.aL + localOEntityLiving.q());
    } else d3 = (paramOEntity.aU.b + paramOEntity.aU.e) / 2.0D - (aL + q());

    double d4 = OMathHelper.a(d1 * d1 + d2 * d2);

    float f1 = (float) (Math.atan2(d2, d1) * 180.0D / 3.141592741012573D) - 90.0F;
    float f2 = (float) (Math.atan2(d3, d4) * 180.0D / 3.141592741012573D);
    aR = (-b(aR, f2, paramFloat2));
    aQ = b(aQ, f1, paramFloat1);
  }
  public OVec3D b(float paramFloat) {
    if (paramFloat == 1.0F) {
      float f1 = OMathHelper.b(-aR * 0.01745329F - 3.141593F);
      float f2 = OMathHelper.a(-aR * 0.01745329F - 3.141593F);
      float f3 = -OMathHelper.b(-aS * 0.01745329F);
      float f4 = OMathHelper.a(-aS * 0.01745329F);

      return OVec3D.b(f2 * f3, f4, f1 * f3);
    }
    float f1 = aU + (aS - aU) * paramFloat;
    float f2 = aT + (aR - aT) * paramFloat;

    float f3 = OMathHelper.b(-f2 * 0.01745329F - 3.141593F);
    float f4 = OMathHelper.a(-f2 * 0.01745329F - 3.141593F);
    float f5 = -OMathHelper.b(-f1 * 0.01745329F);
    float f6 = OMathHelper.a(-f1 * 0.01745329F);

    return OVec3D.b(f4 * f5, f6, f3 * f5);
  }
Exemple #11
0
  public void a(OWorld oworld, int i, int j, int k, OEntityLiving oentityliving) {
    int l = OMathHelper.b((double) (oentityliving.bs * 4.0F / 360.0F) + 0.5D) & 3;
    int i1 = oworld.c(i, j, k) & 4;

    if (l == 0) {
      oworld.c(i, j, k, 2 | i1);
    }

    if (l == 1) {
      oworld.c(i, j, k, 1 | i1);
    }

    if (l == 2) {
      oworld.c(i, j, k, 3 | i1);
    }

    if (l == 3) {
      oworld.c(i, j, k, 0 | i1);
    }
  }
 public boolean p() {
   int i = OMathHelper.b(aL);
   int j = OMathHelper.b(aV.b);
   int k = OMathHelper.b(aN);
   return aH.a(i, j, k) == OBlock.aF.bl;
 }
  public void a(float paramFloat1, float paramFloat2) {
    if (Z()) {
      double d1 = aM;
      a(paramFloat1, paramFloat2, 0.02F);
      c(aO, aP, aQ);

      aO *= 0.8D;
      aP *= 0.8D;
      aQ *= 0.8D;
      aP -= 0.02D;

      if ((aX) && (b(aO, aP + 0.6D - aM + d1, aQ))) aP = 0.3D;
    } else if (aa()) {
      double d1 = aM;
      a(paramFloat1, paramFloat2, 0.02F);
      c(aO, aP, aQ);
      aO *= 0.5D;
      aP *= 0.5D;
      aQ *= 0.5D;
      aP -= 0.02D;

      if ((aX) && (b(aO, aP + 0.6000000238418579D - aM + d1, aQ))) aP = 0.300000011920929D;
    } else {
      float f1 = 0.91F;
      if (aW) {
        f1 = 0.546F;
        int i = aH.a(OMathHelper.b(aL), OMathHelper.b(aV.b) - 1, OMathHelper.b(aN));
        if (i > 0) f1 = OBlock.m[i].bz * 0.91F;
      }

      float f2 = 0.1627714F / (f1 * f1 * f1);
      a(paramFloat1, paramFloat2, aW ? 0.1F * f2 : 0.02F);

      f1 = 0.91F;
      if (aW) {
        f1 = 0.546F;
        int j = aH.a(OMathHelper.b(aL), OMathHelper.b(aV.b) - 1, OMathHelper.b(aN));
        if (j > 0) f1 = OBlock.m[j].bz * 0.91F;
      }

      if (p()) {
        bj = 0.0F;
        if (aP < -0.15D) aP = -0.15D;
        if ((ae()) && (aP < 0.0D)) aP = 0.0D;
      }

      c(aO, aP, aQ);

      if ((aX) && (p())) aP = 0.2D;

      aP -= 0.08D;
      aP *= 0.98D;
      aO *= f1;
      aQ *= f1;
    }
    aj = ak;
    double d1 = aL - aI;
    double d2 = aN - aK;
    float f3 = OMathHelper.a(d1 * d1 + d2 * d2) * 4.0F;
    if (f3 > 1.0F) f3 = 1.0F;
    ak += (f3 - ak) * 0.4F;
    al += ak;
  }
 public boolean n() {
   int i = OMathHelper.b(aK);
   int j = OMathHelper.b(aU.b);
   int k = OMathHelper.b(aM);
   return (aG.a(i, j, k) == OBlock.aF.bl) || (aG.a(i, j + 1, k) == OBlock.aF.bl);
 }
  public void a(float paramFloat1, float paramFloat2) {
    if (g_()) {
      double d1 = aL;
      a(paramFloat1, paramFloat2, 0.02F);
      c(aN, aO, aP);

      aN *= 0.800000011920929D;
      aO *= 0.800000011920929D;
      aP *= 0.800000011920929D;
      aO -= 0.02D;

      if ((aW) && (b(aN, aO + 0.6000000238418579D - aL + d1, aP))) aO = 0.300000011920929D;
    } else if (V()) {
      double d1 = aL;
      a(paramFloat1, paramFloat2, 0.02F);
      c(aN, aO, aP);
      aN *= 0.5D;
      aO *= 0.5D;
      aP *= 0.5D;
      aO -= 0.02D;

      if ((aW) && (b(aN, aO + 0.6000000238418579D - aL + d1, aP))) aO = 0.300000011920929D;
    } else {
      float f1 = 0.91F;
      if (aV) {
        f1 = 0.5460001F;
        int i = aG.a(OMathHelper.b(aK), OMathHelper.b(aU.b) - 1, OMathHelper.b(aM));
        if (i > 0) f1 = OBlock.m[i].bx * 0.91F;
      }

      float f2 = 0.1627714F / (f1 * f1 * f1);
      a(paramFloat1, paramFloat2, aV ? 0.1F * f2 : 0.02F);

      f1 = 0.91F;
      if (aV) {
        f1 = 0.5460001F;
        int j = aG.a(OMathHelper.b(aK), OMathHelper.b(aU.b) - 1, OMathHelper.b(aM));
        if (j > 0) f1 = OBlock.m[j].bx * 0.91F;
      }

      if (n()) {
        bh = 0.0F;
        if (aO < -0.15D) aO = -0.15D;
        if ((Z()) && (aO < 0.0D)) aO = 0.0D;
      }

      c(aN, aO, aP);

      if ((aW) && (n())) aO = 0.2D;

      aO -= 0.08D;
      aO *= 0.9800000190734863D;
      aN *= f1;
      aP *= f1;
    }
    ai = aj;
    double d1 = aK - aH;
    double d2 = aM - aJ;
    float f3 = OMathHelper.a(d1 * d1 + d2 * d2) * 4.0F;
    if (f3 > 1.0F) f3 = 1.0F;
    aj += (f3 - aj) * 0.4F;
    ak += aj;
  }
  public void l_() {
    this.U = this.u;
    this.V = this.v;
    this.W = this.w;
    super.l_();
    if (this.b > 0) {
      --this.b;
    }

    if (this.a) {
      int i = this.q.a(this.c, this.d, this.e);

      if (i == this.f) {
        ++this.i;
        if (this.i == 1200) {
          this.w();
        }

        return;
      }

      this.a = false;
      this.x *= (double) (this.ab.nextFloat() * 0.2F);
      this.y *= (double) (this.ab.nextFloat() * 0.2F);
      this.z *= (double) (this.ab.nextFloat() * 0.2F);
      this.i = 0;
      this.j = 0;
    } else {
      ++this.j;
    }

    OVec3 ovec3 = this.q.T().a(this.u, this.v, this.w);
    OVec3 ovec31 = this.q.T().a(this.u + this.x, this.v + this.y, this.w + this.z);
    OMovingObjectPosition omovingobjectposition = this.q.a(ovec3, ovec31);

    ovec3 = this.q.T().a(this.u, this.v, this.w);
    ovec31 = this.q.T().a(this.u + this.x, this.v + this.y, this.w + this.z);
    if (omovingobjectposition != null) {
      ovec31 =
          this.q
              .T()
              .a(omovingobjectposition.f.c, omovingobjectposition.f.d, omovingobjectposition.f.e);
    }

    if (!this.q.I) {
      OEntity oentity = null;
      List list = this.q.b((OEntity) this, this.E.a(this.x, this.y, this.z).b(1.0D, 1.0D, 1.0D));
      double d0 = 0.0D;
      OEntityLiving oentityliving = this.h();

      for (int j = 0; j < list.size(); ++j) {
        OEntity oentity1 = (OEntity) list.get(j);

        if (oentity1.K() && (oentity1 != oentityliving || this.j >= 5)) {
          float f = 0.3F;
          OAxisAlignedBB oaxisalignedbb = oentity1.E.b((double) f, (double) f, (double) f);
          OMovingObjectPosition omovingobjectposition1 = oaxisalignedbb.a(ovec3, ovec31);

          if (omovingobjectposition1 != null) {
            double d1 = ovec3.d(omovingobjectposition1.f);

            if (d1 < d0 || d0 == 0.0D) {
              oentity = oentity1;
              d0 = d1;
            }
          }
        }
      }

      if (oentity != null) {
        omovingobjectposition = new OMovingObjectPosition(oentity);
      }
    }

    if (omovingobjectposition != null) {
      if (omovingobjectposition.a == OEnumMovingObjectType.a
          && this.q.a(omovingobjectposition.b, omovingobjectposition.c, omovingobjectposition.d)
              == OBlock.bi.cz) {
        this.Z();
      } else {
        this.a(omovingobjectposition);
      }
    }

    this.u += this.x;
    this.v += this.y;
    this.w += this.z;
    float f1 = OMathHelper.a(this.x * this.x + this.z * this.z);

    this.A = (float) (Math.atan2(this.x, this.z) * 180.0D / 3.1415927410125732D);

    for (this.B = (float) (Math.atan2(this.y, (double) f1) * 180.0D / 3.1415927410125732D);
        this.B - this.D < -180.0F;
        this.D -= 360.0F) {;
    }

    while (this.B - this.D >= 180.0F) {
      this.D += 360.0F;
    }

    while (this.A - this.C < -180.0F) {
      this.C -= 360.0F;
    }

    while (this.A - this.C >= 180.0F) {
      this.C += 360.0F;
    }

    this.B = this.D + (this.B - this.D) * 0.2F;
    this.A = this.C + (this.A - this.C) * 0.2F;
    float f2 = 0.99F;
    float f3 = this.g();

    if (this.G()) {
      for (int k = 0; k < 4; ++k) {
        float f4 = 0.25F;

        this.q.a(
            "bubble",
            this.u - this.x * (double) f4,
            this.v - this.y * (double) f4,
            this.w - this.z * (double) f4,
            this.x,
            this.y,
            this.z);
      }

      f2 = 0.8F;
    }

    this.x *= (double) f2;
    this.y *= (double) f2;
    this.z *= (double) f2;
    this.y -= (double) f3;
    this.b(this.u, this.v, this.w);
  }