예제 #1
0
  protected void a(double d0, boolean flag) {
    if (!this.H()) {
      this.I();
    }

    if (flag && this.fallDistance > 0.0F) {
      int i = MathHelper.floor(this.locX);
      int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
      int k = MathHelper.floor(this.locZ);
      int l = this.world.getTypeId(i, j, k);

      if (l == 0) {
        int i1 = this.world.e(i, j - 1, k);

        if (i1 == 11 || i1 == 32 || i1 == 21) {
          l = this.world.getTypeId(i, j - 1, k);
        }
      }

      if (l > 0) {
        Block.byId[l].a(this.world, i, j, k, this, this.fallDistance);
      }
    }

    super.a(d0, flag);
  }
예제 #2
0
  public void die(DamageSource damagesource) {
    Entity entity = damagesource.getEntity();
    EntityLiving entityliving = this.aX();

    if (this.bb >= 0 && entityliving != null) {
      entityliving.b(this, this.bb);
    }

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

    this.aU = true;
    if (!this.world.isStatic) {
      int i = 0;

      if (entity instanceof EntityHuman) {
        i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
      }

      if (this.aG() && this.world.getGameRules().getBoolean("doMobLoot")) {
        this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
        this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
        if (this.lastDamageByPlayerTime > 0) {
          int j = this.random.nextInt(200) - i;

          if (j < 5) {
            this.getRareDrop(j <= 0 ? 1 : 0);
          }
        }
      }
    }

    this.world.broadcastEntityEffect(this, (byte) 3);
  }
예제 #3
0
  protected void a(double d0, boolean flag) {
    if (!this.M()) {
      this.N();
    }

    if (flag && this.fallDistance > 0.0F) {
      int i = MathHelper.floor(this.locX);
      int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
      int k = MathHelper.floor(this.locZ);
      Block block = this.world.getType(i, j, k);

      if (block.getMaterial() == Material.AIR) {
        int l = this.world.getType(i, j - 1, k).b();

        if (l == 11 || l == 32 || l == 21) {
          block = this.world.getType(i, j - 1, k);
        }
      } else if (!this.world.isStatic && this.fallDistance > 3.0F) {
        this.world.triggerEffect(2006, i, j, k, MathHelper.f(this.fallDistance - 3.0F));
      }

      block.a(this.world, i, j, k, this, this.fallDistance);
    }

    super.a(d0, flag);
  }
예제 #4
0
 public void c(double d1, double d2, double d3, float f1, float f2) {
   m = p = d1;
   n = q = d2 + (double) H;
   o = r = d3;
   v = f1;
   w = f2;
   a(p, q, r);
 }
예제 #5
0
 protected void a(double d1, boolean flag) {
   if (flag) {
     if (N > 0.0F) {
       a(N);
       N = 0.0F;
     }
   } else if (d1 < 0.0D) {
     N -= d1;
   }
 }
예제 #6
0
 public void d(NBTTagCompound nbttagcompound) {
   nbttagcompound.a("Pos", a(new double[] {p, q, r}));
   nbttagcompound.a("Motion", a(new double[] {s, t, u}));
   nbttagcompound.a("Rotation", a(new float[] {v, w}));
   nbttagcompound.a("FallDistance", N);
   nbttagcompound.a("Fire", (short) Z);
   nbttagcompound.a("Air", (short) ad);
   nbttagcompound.a("OnGround", A);
   a(nbttagcompound);
 }
예제 #7
0
  public void e(NBTTagCompound nbttagcompound) {
    NBTTagList nbttaglist = nbttagcompound.k("Pos");
    NBTTagList nbttaglist1 = nbttagcompound.k("Motion");
    NBTTagList nbttaglist2 = nbttagcompound.k("Rotation");

    a(0.0D, 0.0D, 0.0D);
    s = ((NBTTagDouble) nbttaglist1.a(0)).a;
    t = ((NBTTagDouble) nbttaglist1.a(1)).a;
    u = ((NBTTagDouble) nbttaglist1.a(2)).a;
    m = O = p = ((NBTTagDouble) nbttaglist.a(0)).a;
    n = P = q = ((NBTTagDouble) nbttaglist.a(1)).a;
    o = Q = r = ((NBTTagDouble) nbttaglist.a(2)).a;
    x = v = ((NBTTagFloat) nbttaglist2.a(0)).a;
    y = w = ((NBTTagFloat) nbttaglist2.a(1)).a;
    N = nbttagcompound.f("FallDistance");
    Z = nbttagcompound.c("Fire");
    ad = nbttagcompound.c("Air");
    A = nbttagcompound.l("OnGround");
    a(p, q, r);
    b(nbttagcompound);
  }
예제 #8
0
  public void b(double d1, double d2, double d3, float f1, float f2) {
    m = p = d1;
    n = q = d2;
    o = r = d3;
    x = v = f1;
    y = w = f2;
    R = 0.0F;
    double d4 = x - f1;

    if (d4 < -180D) {
      x += 360F;
    }
    if (d4 >= 180D) {
      x -= 360F;
    }
    a(p, q, r);
    b(f1, f2);
  }
예제 #9
0
  public void die(DamageSource damagesource) {
    Entity entity = damagesource.getEntity();
    EntityLiving entityliving = this.aS();

    if (this.bb >= 0 && entityliving != null) {
      entityliving.b(this, this.bb);
    }

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

    this.aU = true;
    if (!this.world.isStatic) {
      int i = 0;

      if (entity instanceof EntityHuman) {
        i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
      }

      if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) {
        this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
        this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
        if (false
            && this.lastDamageByPlayerTime
                > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot
          int j = this.random.nextInt(200) - i;

          if (j < 5) {
            this.l(j <= 0 ? 1 : 0);
          }
        }
      } else { // CraftBukkit
        CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit
      }
    }

    this.world.broadcastEntityEffect(this, (byte) 3);
  }
예제 #10
0
 public Entity(World world) {
   g = a++;
   h = 1.0D;
   i = false;
   A = false;
   D = false;
   E = false;
   F = true;
   G = false;
   H = 0.0F;
   I = 0.6F;
   J = 1.8F;
   K = 0.0F;
   L = 0.0F;
   M = true;
   N = 0.0F;
   b = 1;
   R = 0.0F;
   S = 0.0F;
   T = false;
   U = 0.0F;
   V = false;
   W = new Random();
   X = 0;
   Y = 1;
   Z = 0;
   aa = 300;
   ab = false;
   ac = 0;
   ad = 300;
   c = true;
   ae = false;
   af = false;
   l = world;
   a(0.0D, 0.0D, 0.0D);
 }
예제 #11
0
  public void e(NBTTagCompound nbttagcompound) {
    NBTTagList nbttaglist = nbttagcompound.l("Pos");
    NBTTagList nbttaglist1 = nbttagcompound.l("Motion");
    NBTTagList nbttaglist2 = nbttagcompound.l("Rotation");

    this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
    this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
    this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
    /* CraftBukkit start - moved section down
    if (Math.abs(this.motX) > 10.0D) {
        this.motX = 0.0D;
    }

    if (Math.abs(this.motY) > 10.0D) {
        this.motY = 0.0D;
    }

    if (Math.abs(this.motZ) > 10.0D) {
        this.motZ = 0.0D;
    }
    // CraftBukkit end */

    this.lastX = this.bo = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
    this.lastY = this.bp = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
    this.lastZ = this.bq = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
    this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
    this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a;
    this.fallDistance = nbttagcompound.g("FallDistance");
    this.fireTicks = nbttagcompound.d("Fire");
    this.airTicks = nbttagcompound.d("Air");
    this.onGround = nbttagcompound.m("OnGround");
    this.setPosition(this.locX, this.locY, this.locZ);

    // CraftBukkit start
    long least = nbttagcompound.f("UUIDLeast");
    long most = nbttagcompound.f("UUIDMost");

    if (least != 0L && most != 0L) {
      this.uniqueId = new UUID(most, least);
    }
    // CraftBukkit end

    this.c(this.yaw, this.pitch);
    this.a(nbttagcompound);

    // CraftBukkit start - Exempt Vehicles from notch's sanity check
    if (!(this.getBukkitEntity() instanceof CraftVehicle)) {
      if (Math.abs(this.motX) > 10.0D) {
        this.motX = 0.0D;
      }

      if (Math.abs(this.motY) > 10.0D) {
        this.motY = 0.0D;
      }

      if (Math.abs(this.motZ) > 10.0D) {
        this.motZ = 0.0D;
      }
    }
    // CraftBukkit end

    // CraftBukkit Start - reset world
    CraftWorld world = null;
    if (this instanceof EntityPlayer) {
      EntityPlayer entityPlayer = (EntityPlayer) this;
      String worldName = nbttagcompound.getString("World");
      if (worldName == "") {
        world = ((CraftServer) Bukkit.getServer()).getServer().a(entityPlayer.dimension).getWorld();
      } else {
        world = (CraftWorld) Bukkit.getServer().getWorld(worldName);
      }
    } else {
      world = (CraftWorld) Bukkit.getServer().getWorld(nbttagcompound.getString("World"));
    }

    a(world == null ? null : world.getHandle());
    // CraftBukkit End
  }
예제 #12
0
  public void w_() {
    super.w_();
    if (this.lifeTicks == 2) {
      this.world.makeSound(
          this.locX,
          this.locY,
          this.locZ,
          "ambient.weather.thunder",
          10000.0F,
          0.8F + this.random.nextFloat() * 0.2F);
      this.world.makeSound(
          this.locX,
          this.locY,
          this.locZ,
          "random.explode",
          2.0F,
          0.5F + this.random.nextFloat() * 0.2F);
    }

    --this.lifeTicks;
    if (this.lifeTicks < 0) {
      if (this.c == 0) {
        this.die();
      } else if (this.lifeTicks < -this.random.nextInt(10)) {
        --this.c;
        this.lifeTicks = 1;
        this.a = this.random.nextLong();
        if (this.world.areChunksLoaded(
            MathHelper.floor(this.locX),
            MathHelper.floor(this.locY),
            MathHelper.floor(this.locZ),
            10)) {
          int i = MathHelper.floor(this.locX);
          int j = MathHelper.floor(this.locY);
          int k = MathHelper.floor(this.locZ);

          if (this.world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(this.world, i, j, k)) {
            this.world.setTypeId(i, j, k, Block.FIRE.id);
          }
        }
      }
    }

    if (this.lifeTicks >= 0) {
      double d0 = 3.0D;
      List list =
          this.world.b(
              (Entity) this,
              AxisAlignedBB.b(
                  this.locX - d0,
                  this.locY - d0,
                  this.locZ - d0,
                  this.locX + d0,
                  this.locY + 6.0D + d0,
                  this.locZ + d0));

      for (int l = 0; l < list.size(); ++l) {
        Entity entity = (Entity) list.get(l);

        entity.a(this);
      }

      this.world.s = 2;
    }
  }
예제 #13
0
 public void A() {
   j.a(p, q + j() + j.B(), r);
 }
예제 #14
0
  public void m() {
    if (k != null && k.G) {
      k = null;
    }
    X++;
    K = L;
    m = p;
    n = q;
    o = r;
    y = w;
    x = v;
    if (r()) {
      if (!ab && !c) {
        float f1 =
            MathHelper.a(s * s * 0.20000000298023224D + t * t + u * u * 0.20000000298023224D)
                * 0.2F;

        if (f1 > 1.0F) {
          f1 = 1.0F;
        }
        l.a(this, "random.splash", f1, 1.0F + (W.nextFloat() - W.nextFloat()) * 0.4F);
        float f2 = MathHelper.b(z.b);

        for (int i1 = 0; (float) i1 < 1.0F + I * 20F; i1++) {
          float f3 = (W.nextFloat() * 2.0F - 1.0F) * I;
          float f5 = (W.nextFloat() * 2.0F - 1.0F) * I;

          l.a(
              "bubble",
              p + (double) f3,
              f2 + 1.0F,
              r + (double) f5,
              s,
              t - (double) (W.nextFloat() * 0.2F),
              u);
        }

        for (int j1 = 0; (float) j1 < 1.0F + I * 20F; j1++) {
          float f4 = (W.nextFloat() * 2.0F - 1.0F) * I;
          float f6 = (W.nextFloat() * 2.0F - 1.0F) * I;

          l.a("splash", p + (double) f4, f2 + 1.0F, r + (double) f6, s, t, u);
        }
      }
      N = 0.0F;
      ab = true;
      Z = 0;
    } else {
      ab = false;
    }
    if (l.z) {
      Z = 0;
    } else if (Z > 0) {
      if (ae) {
        Z -= 4;
        if (Z < 0) {
          Z = 0;
        }
      } else {
        if (Z % 20 == 0) {
          a(((Entity) (null)), 1);
        }
        Z--;
      }
    }
    if (t()) {
      n();
    }
    if (q < -64D) {
      o();
    }
    c = false;
  }
예제 #15
0
 protected void n() {
   if (!ae) {
     a(((Entity) (null)), 4);
     Z = 600;
   }
 }
예제 #16
0
  public void c(double d1, double d2, double d3) {
    if (T) {
      z.d(d1, d2, d3);
      p = (z.a + z.d) / 2D;
      q = (z.b + (double) H) - (double) R;
      r = (z.c + z.f) / 2D;
      return;
    }
    double d4 = p;
    double d5 = r;
    double d6 = d1;
    double d7 = d2;
    double d8 = d3;
    AxisAlignedBB axisalignedbb = z.b();
    boolean flag = A && p();

    if (flag) {
      double d9 = 0.050000000000000003D;

      for (; d1 != 0.0D && l.a(this, z.c(d1, -1D, 0.0D)).size() == 0; d6 = d1) {
        if (d1 < d9 && d1 >= -d9) {
          d1 = 0.0D;
          continue;
        }
        if (d1 > 0.0D) {
          d1 -= d9;
        } else {
          d1 += d9;
        }
      }

      for (; d3 != 0.0D && l.a(this, z.c(0.0D, -1D, d3)).size() == 0; d8 = d3) {
        if (d3 < d9 && d3 >= -d9) {
          d3 = 0.0D;
          continue;
        }
        if (d3 > 0.0D) {
          d3 -= d9;
        } else {
          d3 += d9;
        }
      }
    }
    List list = l.a(this, z.a(d1, d2, d3));

    for (int i1 = 0; i1 < list.size(); i1++) {
      d2 = ((AxisAlignedBB) list.get(i1)).b(z, d2);
    }

    z.d(0.0D, d2, 0.0D);
    if (!F && d7 != d2) {
      d1 = d2 = d3 = 0.0D;
    }
    boolean flag1 = A || d7 != d2 && d7 < 0.0D;

    for (int j1 = 0; j1 < list.size(); j1++) {
      d1 = ((AxisAlignedBB) list.get(j1)).a(z, d1);
    }

    z.d(d1, 0.0D, 0.0D);
    if (!F && d6 != d1) {
      d1 = d2 = d3 = 0.0D;
    }
    for (int k1 = 0; k1 < list.size(); k1++) {
      d3 = ((AxisAlignedBB) list.get(k1)).c(z, d3);
    }

    z.d(0.0D, 0.0D, d3);
    if (!F && d8 != d3) {
      d1 = d2 = d3 = 0.0D;
    }
    if (S > 0.0F && flag1 && R < 0.05F && (d6 != d1 || d8 != d3)) {
      double d10 = d1;
      double d12 = d2;
      double d14 = d3;

      d1 = d6;
      d2 = S;
      d3 = d8;
      AxisAlignedBB axisalignedbb1 = z.b();

      z.b(axisalignedbb);
      List list1 = l.a(this, z.a(d1, d2, d3));

      for (int j2 = 0; j2 < list1.size(); j2++) {
        d2 = ((AxisAlignedBB) list1.get(j2)).b(z, d2);
      }

      z.d(0.0D, d2, 0.0D);
      if (!F && d7 != d2) {
        d1 = d2 = d3 = 0.0D;
      }
      for (int k2 = 0; k2 < list1.size(); k2++) {
        d1 = ((AxisAlignedBB) list1.get(k2)).a(z, d1);
      }

      z.d(d1, 0.0D, 0.0D);
      if (!F && d6 != d1) {
        d1 = d2 = d3 = 0.0D;
      }
      for (int l2 = 0; l2 < list1.size(); l2++) {
        d3 = ((AxisAlignedBB) list1.get(l2)).c(z, d3);
      }

      z.d(0.0D, 0.0D, d3);
      if (!F && d8 != d3) {
        d1 = d2 = d3 = 0.0D;
      }
      if (d10 * d10 + d14 * d14 >= d1 * d1 + d3 * d3) {
        d1 = d10;
        d2 = d12;
        d3 = d14;
        z.b(axisalignedbb1);
      } else {
        R += 0.5D;
      }
    }
    p = (z.a + z.d) / 2D;
    q = (z.b + (double) H) - (double) R;
    r = (z.c + z.f) / 2D;
    B = d6 != d1 || d8 != d3;
    C = d7 != d2;
    A = d7 != d2 && d7 < 0.0D;
    D = B || C;
    a(d2, A);
    if (d6 != d1) {
      s = 0.0D;
    }
    if (d7 != d2) {
      t = 0.0D;
    }
    if (d8 != d3) {
      u = 0.0D;
    }
    double d11 = p - d4;
    double d13 = r - d5;

    if (M && !flag) {
      L += (double) MathHelper.a(d11 * d11 + d13 * d13) * 0.59999999999999998D;
      int k3 = MathHelper.b(p);
      int i4 = MathHelper.b(q - 0.20000000298023224D - (double) H);
      int l1 = MathHelper.b(r);
      int i3 = l.a(k3, i4, l1);

      if (L > (float) b && i3 > 0) {
        b++;
        StepSound stepsound = Block.m[i3].bq;

        if (l.a(k3, i4 + 1, l1) == Block.aS.bh) {
          stepsound = Block.aS.bq;
          l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b());
        } else if (!Block.m[i3].bs.d()) {
          l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b());
        }
        Block.m[i3].b(l, k3, i4, l1, this);
      }
    }
    int l3 = MathHelper.b(z.a);
    int j4 = MathHelper.b(z.b);
    int i2 = MathHelper.b(z.c);
    int j3 = MathHelper.b(z.d);
    int k4 = MathHelper.b(z.e);
    int l4 = MathHelper.b(z.f);

    for (int i5 = l3; i5 <= j3; i5++) {
      for (int j5 = j4; j5 <= k4; j5++) {
        for (int k5 = i2; k5 <= l4; k5++) {
          int l5 = l.a(i5, j5, k5);

          if (l5 > 0) {
            Block.m[l5].a(l, i5, j5, k5, this);
          }
        }
      }
    }

    R *= 0.4F;
    boolean flag2 = r();

    if (l.c(z)) {
      b(1);
      if (!flag2) {
        Z++;
        if (Z == 0) {
          Z = 300;
        }
      }
    } else if (Z <= 0) {
      Z = -Y;
    }
    if (flag2 && Z > 0) {
      l.a(this, "random.fizz", 0.7F, 1.6F + (W.nextFloat() - W.nextFloat()) * 0.4F);
      Z = -Y;
    }
  }
예제 #17
0
 protected void b(int i1) {
   if (!ae) {
     a(((Entity) (null)), i1);
   }
 }