コード例 #1
0
  private static boolean func_72292_n(
      World p_72292_0_, int p_72292_1_, int p_72292_2_, int p_72292_3_) {
    for (Iterator iterator =
            p_72292_0_
                .func_72872_a(
                    net.minecraft.src.EntityOcelot.class,
                    AxisAlignedBB.func_72332_a()
                        .func_72299_a(
                            p_72292_1_,
                            p_72292_2_ + 1,
                            p_72292_3_,
                            p_72292_1_ + 1,
                            p_72292_2_ + 2,
                            p_72292_3_ + 1))
                .iterator();
        iterator.hasNext(); ) {
      EntityOcelot entityocelot = (EntityOcelot) iterator.next();
      EntityOcelot entityocelot1 = (EntityOcelot) entityocelot;
      if (entityocelot1.func_70906_o()) {
        return true;
      }
    }

    return false;
  }
コード例 #2
0
 protected void alertWolves(EntityLiving entityliving, boolean flag) {
   if ((entityliving instanceof EntityCreeper) || (entityliving instanceof EntityGhast)) {
     return;
   }
   if (entityliving instanceof EntityWolf) {
     EntityWolf entitywolf = (EntityWolf) entityliving;
     if (entitywolf.isTamed() && username.equals(entitywolf.getOwner())) {
       return;
     }
   }
   if ((entityliving instanceof EntityPlayer) && !isPVPEnabled()) {
     return;
   }
   List list =
       worldObj.getEntitiesWithinAABB(
           net.minecraft.src.EntityWolf.class,
           AxisAlignedBB.getBoundingBoxFromPool(
                   posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D)
               .expand(16D, 4D, 16D));
   Iterator iterator = list.iterator();
   do {
     if (!iterator.hasNext()) {
       break;
     }
     Entity entity = (Entity) iterator.next();
     EntityWolf entitywolf1 = (EntityWolf) entity;
     if (entitywolf1.isTamed()
         && entitywolf1.getEntityToAttack() == null
         && username.equals(entitywolf1.getOwner())
         && (!flag || !entitywolf1.isSitting())) {
       entitywolf1.setIsSitting(false);
       entitywolf1.setEntityToAttack(entityliving);
     }
   } while (true);
 }
コード例 #3
0
 public void func_1197_a(int i, int j, int k) {
   if (i == field_1761_c && j == field_1760_d && k == field_1759_e) {
     return;
   } else {
     func_1195_b();
     field_1761_c = i;
     field_1760_d = j;
     field_1759_e = k;
     field_1746_q = i + field_1758_f / 2;
     field_1743_r = j + field_1757_g / 2;
     field_1741_s = k + field_1756_h / 2;
     field_1752_l = i & 0x3ff;
     field_1751_m = j;
     field_1750_n = k & 0x3ff;
     field_1755_i = i - field_1752_l;
     field_1754_j = j - field_1751_m;
     field_1753_k = k - field_1750_n;
     float f = 6F;
     field_1736_v =
         AxisAlignedBB.func_1168_a(
             (float) i - f,
             (float) j - f,
             (float) k - f,
             (float) (i + field_1758_f) + f,
             (float) (j + field_1757_g) + f,
             (float) (k + field_1756_h) + f);
     GL11.glNewList(field_1744_C + 2, 4864);
     RenderItem.func_142_a(
         AxisAlignedBB.func_1161_b(
             (float) field_1752_l - f,
             (float) field_1751_m - f,
             (float) field_1750_n - f,
             (float) (field_1752_l + field_1758_f) + f,
             (float) (field_1751_m + field_1757_g) + f,
             (float) (field_1750_n + field_1756_h) + f));
     GL11.glEndList();
     func_1194_f();
     return;
   }
 }
コード例 #4
0
  @Override
  public AxisAlignedBB getSelectedBoundingBoxFromPool(
      World par1World, int par2, int par3, int par4) {
    int i = par1World.getBlockMetadata(par2, par3, par4);
    float f = 0.375F;

    setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
    if (i == 0) {
      setBlockBounds(0.0F, 1.0F - f, 0.0F, 1.0F, 1.0F, 1.0F);
    }

    if (i == 1) {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
    }

    if (i == 2) {
      setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
    }

    if (i == 3) {
      setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
    }

    if (i == 4) {
      setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    }

    if (i == 5) {
      setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
    }
    AxisAlignedBB box =
        AxisAlignedBB.getAABBPool()
            .getAABB(
                par2 + this.minX,
                par3 + this.minY,
                par4 + this.minZ,
                par2 + this.maxX,
                par3 + this.maxY,
                par4 + this.maxZ);
    setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.375F);
    return box;
  }
コード例 #5
0
  public void func_70071_h_() {
    if (!field_70170_p.field_72995_K
        && (field_70235_a != null && field_70235_a.field_70128_L
            || !field_70170_p.func_72899_e(
                (int) field_70165_t, (int) field_70163_u, (int) field_70161_v))) {
      func_70106_y();
      return;
    }
    super.func_70071_h_();
    func_70015_d(1);
    if (field_70238_i) {
      int i = field_70170_p.func_72798_a(field_70231_e, field_70228_f, field_70229_g);
      if (i == field_70237_h) {
        field_70236_j++;
        if (field_70236_j == 600) {
          func_70106_y();
        }
        return;
      }
      field_70238_i = false;
      field_70159_w *= field_70146_Z.nextFloat() * 0.2F;
      field_70181_x *= field_70146_Z.nextFloat() * 0.2F;
      field_70179_y *= field_70146_Z.nextFloat() * 0.2F;
      field_70236_j = 0;
      field_70234_an = 0;
    } else {
      field_70234_an++;
    }
    Vec3 vec3 = Vec3.func_72437_a().func_72345_a(field_70165_t, field_70163_u, field_70161_v);
    Vec3 vec3_1 =
        Vec3.func_72437_a()
            .func_72345_a(
                field_70165_t + field_70159_w,
                field_70163_u + field_70181_x,
                field_70161_v + field_70179_y);
    MovingObjectPosition movingobjectposition = field_70170_p.func_72933_a(vec3, vec3_1);
    vec3 = Vec3.func_72437_a().func_72345_a(field_70165_t, field_70163_u, field_70161_v);
    vec3_1 =
        Vec3.func_72437_a()
            .func_72345_a(
                field_70165_t + field_70159_w,
                field_70163_u + field_70181_x,
                field_70161_v + field_70179_y);
    if (movingobjectposition != null) {
      vec3_1 =
          Vec3.func_72437_a()
              .func_72345_a(
                  movingobjectposition.field_72307_f.field_72450_a,
                  movingobjectposition.field_72307_f.field_72448_b,
                  movingobjectposition.field_72307_f.field_72449_c);
    }
    Entity entity = null;
    List list =
        field_70170_p.func_72839_b(
            this,
            field_70121_D
                .func_72321_a(field_70159_w, field_70181_x, field_70179_y)
                .func_72314_b(1.0D, 1.0D, 1.0D));
    double d = 0.0D;
    Iterator iterator = list.iterator();
    do {
      if (!iterator.hasNext()) {
        break;
      }
      Entity entity1 = (Entity) iterator.next();
      if (entity1.func_70067_L()
          && (!entity1.func_70028_i(field_70235_a) || field_70234_an >= 25)) {
        float f2 = 0.3F;
        AxisAlignedBB axisalignedbb = entity1.field_70121_D.func_72314_b(f2, f2, f2);
        MovingObjectPosition movingobjectposition1 = axisalignedbb.func_72327_a(vec3, vec3_1);
        if (movingobjectposition1 != null) {
          double d1 = vec3.func_72438_d(movingobjectposition1.field_72307_f);
          if (d1 < d || d == 0.0D) {
            entity = entity1;
            d = d1;
          }
        }
      }
    } while (true);
    if (entity != null) {
      movingobjectposition = new MovingObjectPosition(entity);
    }
    if (movingobjectposition != null) {
      func_70227_a(movingobjectposition);
    }
    field_70165_t += field_70159_w;
    field_70163_u += field_70181_x;
    field_70161_v += field_70179_y;
    float f =
        MathHelper.func_76133_a(field_70159_w * field_70159_w + field_70179_y * field_70179_y);
    field_70177_z =
        (float) ((Math.atan2(field_70159_w, field_70179_y) * 180D) / 3.1415927410125732D);
    for (field_70125_A = (float) ((Math.atan2(field_70181_x, f) * 180D) / 3.1415927410125732D);
        field_70125_A - field_70127_C < -180F;
        field_70127_C -= 360F) {}
    for (; field_70125_A - field_70127_C >= 180F; field_70127_C += 360F) {}
    for (; field_70177_z - field_70126_B < -180F; field_70126_B -= 360F) {}
    for (; field_70177_z - field_70126_B >= 180F; field_70126_B += 360F) {}
    field_70125_A = field_70127_C + (field_70125_A - field_70127_C) * 0.2F;
    field_70177_z = field_70126_B + (field_70177_z - field_70126_B) * 0.2F;
    float f1 = 0.95F;
    if (func_70090_H()) {
      for (int j = 0; j < 4; j++) {
        float f3 = 0.25F;
        field_70170_p.func_72869_a(
            "bubble",
            field_70165_t - field_70159_w * (double) f3,
            field_70163_u - field_70181_x * (double) f3,
            field_70161_v - field_70179_y * (double) f3,
            field_70159_w,
            field_70181_x,
            field_70179_y);
      }

      f1 = 0.8F;
    }
    field_70159_w += field_70232_b;
    field_70181_x += field_70233_c;
    field_70179_y += field_70230_d;
    field_70159_w *= f1;
    field_70181_x *= f1;
    field_70179_y *= f1;
    field_70170_p.func_72869_a(
        "smoke", field_70165_t, field_70163_u + 0.5D, field_70161_v, 0.0D, 0.0D, 0.0D);
    func_70107_b(field_70165_t, field_70163_u, field_70161_v);
  }
コード例 #6
0
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    if (!anyPlayerInRange()) {
      return;
    }

    if (worldObj.isRemote) {
      double d = (float) xCoord + worldObj.rand.nextFloat();
      double d1 = (float) yCoord + worldObj.rand.nextFloat();
      double d3 = (float) zCoord + worldObj.rand.nextFloat();
      worldObj.spawnParticle("smoke", d, d1, d3, 0.0D, 0.0D, 0.0D);
      worldObj.spawnParticle("flame", d, d1, d3, 0.0D, 0.0D, 0.0D);
      yaw2 = yaw % 360D;
      yaw += 4.5454545021057129D;
    } else {
      if (delay == -1) {
        updateDelay();
      }

      if (delay > 0) {
        delay--;
        return;
      }

      for (int i = 0; i < field_70395_h; i++) {
        Entity entity = EntityList.createEntityByName(mobID, worldObj);

        if (entity == null) {
          return;
        }

        int j =
            worldObj
                .getEntitiesWithinAABB(
                    entity.getClass(),
                    AxisAlignedBB.getAABBPool()
                        .addOrModifyAABBInPool(
                            xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)
                        .expand(8D, 4D, 8D))
                .size();

        if (j >= 6) {
          updateDelay();
          return;
        }

        if (entity == null) {
          continue;
        }

        double d2 =
            (double) xCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * 4D;
        double d4 = (yCoord + worldObj.rand.nextInt(3)) - 1;
        double d5 =
            (double) zCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * 4D;
        EntityLiving entityliving = (entity instanceof EntityLiving) ? (EntityLiving) entity : null;
        entity.setLocationAndAngles(d2, d4, d5, worldObj.rand.nextFloat() * 360F, 0.0F);

        if (entityliving != null && !entityliving.getCanSpawnHere()) {
          continue;
        }

        func_70383_a(entity);
        worldObj.spawnEntityInWorld(entity);
        worldObj.playAuxSFX(2004, xCoord, yCoord, zCoord, 0);

        if (entityliving != null) {
          entityliving.spawnExplosionParticle();
        }

        updateDelay();
      }
    }

    super.updateEntity();
  }
コード例 #7
0
  public EnumStatus sleepInBedAt(int i, int j, int k) {
    if (!worldObj.multiplayerWorld) {
      if (isPlayerSleeping() || !isEntityAlive()) {
        return EnumStatus.OTHER_PROBLEM;
      }
      if (worldObj.worldProvider.isAlternateDimension) {
        return EnumStatus.NOT_POSSIBLE_HERE;
      }
      if (worldObj.isDaytime()) {
        return EnumStatus.NOT_POSSIBLE_NOW;
      }
      if (Math.abs(posX - (double) i) > 3D
          || Math.abs(posY - (double) j) > 2D
          || Math.abs(posZ - (double) k) > 3D) {
        return EnumStatus.TOO_FAR_AWAY;
      }
      double d = 8D;
      double d1 = 5D;
      List list =
          worldObj.getEntitiesWithinAABB(
              net.minecraft.src.EntityMob.class,
              AxisAlignedBB.getBoundingBoxFromPool(
                  (double) i - d,
                  (double) j - d1,
                  (double) k - d,
                  (double) i + d,
                  (double) j + d1,
                  (double) k + d));
      if (!list.isEmpty()) {
        return EnumStatus.NOT_SAFE;
      }
    }
    setSize(0.2F, 0.2F);
    yOffset = 0.2F;
    if (worldObj.blockExists(i, j, k)) {
      int l = worldObj.getBlockMetadata(i, j, k);
      int i1 = BlockBed.getDirectionFromMetadata(l);
      float f = 0.5F;
      float f1 = 0.5F;
      switch (i1) {
        case 0:
          f1 = 0.9F;
          break;

        case 2:
          f1 = 0.1F;
          break;

        case 1:
          f = 0.1F;
          break;

        case 3:
          f = 0.9F;
          break;
      }
      func_22052_e(i1);
      setPosition((float) i + f, (float) j + 0.9375F, (float) k + f1);
    } else {
      setPosition((float) i + 0.5F, (float) j + 0.9375F, (float) k + 0.5F);
    }
    sleeping = true;
    sleepTimer = 0;
    bedChunkCoordinates = new ChunkCoordinates(i, j, k);
    motionX = motionZ = motionY = 0.0D;
    if (!worldObj.multiplayerWorld) {
      worldObj.updateAllPlayersSleepingFlag();
    }
    return EnumStatus.OK;
  }
コード例 #8
0
  public void func_77278_a() {
    float f = field_77280_f;
    HashSet hashset = new HashSet();
    for (int i = 0; i < field_77289_h; i++) {
      for (int k = 0; k < field_77289_h; k++) {
        label0:
        for (int i1 = 0; i1 < field_77289_h; i1++) {
          if (i != 0
              && i != field_77289_h - 1
              && k != 0
              && k != field_77289_h - 1
              && i1 != 0
              && i1 != field_77289_h - 1) {
            continue;
          }
          double d = ((float) i / ((float) field_77289_h - 1.0F)) * 2.0F - 1.0F;
          double d1 = ((float) k / ((float) field_77289_h - 1.0F)) * 2.0F - 1.0F;
          double d2 = ((float) i1 / ((float) field_77289_h - 1.0F)) * 2.0F - 1.0F;
          double d3 = Math.sqrt(d * d + d1 * d1 + d2 * d2);
          d /= d3;
          d1 /= d3;
          d2 /= d3;
          float f1 = field_77280_f * (0.7F + field_77287_j.field_73012_v.nextFloat() * 0.6F);
          double d5 = field_77284_b;
          double d7 = field_77285_c;
          double d9 = field_77282_d;
          float f2 = 0.3F;
          do {
            if (f1 <= 0.0F) {
              continue label0;
            }
            int k2 = MathHelper.func_76128_c(d5);
            int l2 = MathHelper.func_76128_c(d7);
            int i3 = MathHelper.func_76128_c(d9);
            int j3 = field_77287_j.func_72798_a(k2, l2, i3);
            if (j3 > 0) {
              f1 -= (Block.field_71973_m[j3].func_71904_a(field_77283_e) + 0.3F) * f2;
            }
            if (f1 > 0.0F) {
              hashset.add(new ChunkPosition(k2, l2, i3));
            }
            d5 += d * (double) f2;
            d7 += d1 * (double) f2;
            d9 += d2 * (double) f2;
            f1 -= f2 * 0.75F;
          } while (true);
        }
      }
    }

    field_77281_g.addAll(hashset);
    field_77280_f *= 2.0F;
    int j = MathHelper.func_76128_c(field_77284_b - (double) field_77280_f - 1.0D);
    int l = MathHelper.func_76128_c(field_77284_b + (double) field_77280_f + 1.0D);
    int j1 = MathHelper.func_76128_c(field_77285_c - (double) field_77280_f - 1.0D);
    int k1 = MathHelper.func_76128_c(field_77285_c + (double) field_77280_f + 1.0D);
    int l1 = MathHelper.func_76128_c(field_77282_d - (double) field_77280_f - 1.0D);
    int i2 = MathHelper.func_76128_c(field_77282_d + (double) field_77280_f + 1.0D);
    List list =
        field_77287_j.func_72839_b(
            field_77283_e, AxisAlignedBB.func_72332_a().func_72299_a(j, j1, l1, l, k1, i2));
    Vec3 vec3 = Vec3.func_72437_a().func_72345_a(field_77284_b, field_77285_c, field_77282_d);
    for (int j2 = 0; j2 < list.size(); j2++) {
      Entity entity = (Entity) list.get(j2);
      double d4 =
          entity.func_70011_f(field_77284_b, field_77285_c, field_77282_d) / (double) field_77280_f;
      if (d4 > 1.0D) {
        continue;
      }
      double d6 = entity.field_70165_t - field_77284_b;
      double d8 = (entity.field_70163_u + (double) entity.func_70047_e()) - field_77285_c;
      double d10 = entity.field_70161_v - field_77282_d;
      double d11 = MathHelper.func_76133_a(d6 * d6 + d8 * d8 + d10 * d10);
      if (d11 == 0.0D) {
        continue;
      }
      d6 /= d11;
      d8 /= d11;
      d10 /= d11;
      double d12 = field_77287_j.func_72842_a(vec3, entity.field_70121_D);
      double d13 = (1.0D - d4) * d12;
      entity.func_70097_a(
          DamageSource.field_76378_k,
          (int) (((d13 * d13 + d13) / 2D) * 8D * (double) field_77280_f + 1.0D));
      entity.field_70159_w += d6 * d13;
      entity.field_70181_x += d8 * d13;
      entity.field_70179_y += d10 * d13;
      if (entity instanceof EntityPlayer) {
        field_77288_k.put(
            (EntityPlayer) entity, Vec3.func_72437_a().func_72345_a(d6 * d13, d8 * d13, d10 * d13));
      }
    }

    field_77280_f = f;
  }
コード例 #9
0
  public void doExplosion() {
    float f = explosionSize;
    int i = 16;
    for (int j = 0; j < i; j++) {
      for (int l = 0; l < i; l++) {
        label0:
        for (int j1 = 0; j1 < i; j1++) {
          if (j != 0 && j != i - 1 && l != 0 && l != i - 1 && j1 != 0 && j1 != i - 1) {
            continue;
          }
          double d = ((float) j / ((float) i - 1.0F)) * 2.0F - 1.0F;
          double d1 = ((float) l / ((float) i - 1.0F)) * 2.0F - 1.0F;
          double d2 = ((float) j1 / ((float) i - 1.0F)) * 2.0F - 1.0F;
          double d3 = Math.sqrt(d * d + d1 * d1 + d2 * d2);
          d /= d3;
          d1 /= d3;
          d2 /= d3;
          float f1 = explosionSize * (0.7F + worldObj.rand.nextFloat() * 0.6F);
          double d5 = explosionX;
          double d7 = explosionY;
          double d9 = explosionZ;
          float f2 = 0.3F;
          do {
            if (f1 <= 0.0F) {
              continue label0;
            }
            int j4 = MathHelper.floor_double(d5);
            int k4 = MathHelper.floor_double(d7);
            int l4 = MathHelper.floor_double(d9);
            int i5 = worldObj.getBlockId(j4, k4, l4);
            if (i5 > 0) {
              f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
            }
            if (f1 > 0.0F) {
              destroyedBlockPositions.add(new ChunkPosition(j4, k4, l4));
            }
            d5 += d * (double) f2;
            d7 += d1 * (double) f2;
            d9 += d2 * (double) f2;
            f1 -= f2 * 0.75F;
          } while (true);
        }
      }
    }

    explosionSize *= 2.0F;
    int k = MathHelper.floor_double(explosionX - (double) explosionSize - 1.0D);
    int i1 = MathHelper.floor_double(explosionX + (double) explosionSize + 1.0D);
    int k1 = MathHelper.floor_double(explosionY - (double) explosionSize - 1.0D);
    int l1 = MathHelper.floor_double(explosionY + (double) explosionSize + 1.0D);
    int i2 = MathHelper.floor_double(explosionZ - (double) explosionSize - 1.0D);
    int j2 = MathHelper.floor_double(explosionZ + (double) explosionSize + 1.0D);
    List list =
        worldObj.getEntitiesWithinAABBExcludingEntity(
            exploder, AxisAlignedBB.getBoundingBoxFromPool(k, k1, i2, i1, l1, j2));
    Vec3D vec3d = Vec3D.createVector(explosionX, explosionY, explosionZ);
    for (int k2 = 0; k2 < list.size(); k2++) {
      Entity entity = (Entity) list.get(k2);
      double d4 = entity.getDistance(explosionX, explosionY, explosionZ) / (double) explosionSize;
      if (d4 <= 1.0D) {
        double d6 = entity.posX - explosionX;
        double d8 = entity.posY - explosionY;
        double d10 = entity.posZ - explosionZ;
        double d11 = MathHelper.sqrt_double(d6 * d6 + d8 * d8 + d10 * d10);
        d6 /= d11;
        d8 /= d11;
        d10 /= d11;
        double d12 = worldObj.func_494_a(vec3d, entity.boundingBox);
        double d13 = (1.0D - d4) * d12;
        entity.attackEntityFrom(
            exploder, (int) (((d13 * d13 + d13) / 2D) * 8D * (double) explosionSize + 1.0D));
        double d14 = d13;
        entity.motionX += d6 * d14;
        entity.motionY += d8 * d14;
        entity.motionZ += d10 * d14;
      }
    }

    explosionSize = f;
    ArrayList arraylist = new ArrayList();
    arraylist.addAll(destroyedBlockPositions);
    if (isFlaming) {
      for (int l2 = arraylist.size() - 1; l2 >= 0; l2--) {
        ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l2);
        int i3 = chunkposition.x;
        int j3 = chunkposition.y;
        int k3 = chunkposition.z;
        int l3 = worldObj.getBlockId(i3, j3, k3);
        int i4 = worldObj.getBlockId(i3, j3 - 1, k3);
        if (l3 == 0 && Block.opaqueCubeLookup[i4] && ExplosionRNG.nextInt(3) == 0) {
          worldObj.setBlockWithNotify(i3, j3, k3, Block.fire.blockID);
        }
      }
    }
  }