示例#1
0
  /**
   * Gets all entities that can be assigned to the specified class. Args: entityClass, aabb,
   * listToFill
   */
  public void getEntitiesOfTypeWithinAAAB(
      Class par1Class,
      AxisAlignedBB par2AxisAlignedBB,
      List par3List,
      IEntitySelector par4IEntitySelector) {
    int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
    int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);

    if (var5 < 0) {
      var5 = 0;
    } else if (var5 >= this.entityLists.length) {
      var5 = this.entityLists.length - 1;
    }

    if (var6 >= this.entityLists.length) {
      var6 = this.entityLists.length - 1;
    } else if (var6 < 0) {
      var6 = 0;
    }

    for (int var7 = var5; var7 <= var6; ++var7) {
      List var8 = this.entityLists[var7];

      for (int var9 = 0; var9 < var8.size(); ++var9) {
        Entity var10 = (Entity) var8.get(var9);

        if (par1Class.isAssignableFrom(var10.getClass())
            && var10.boundingBox.intersectsWith(par2AxisAlignedBB)
            && (par4IEntitySelector == null || par4IEntitySelector.isEntityApplicable(var10))) {
          par3List.add(var10);
        }
      }
    }
  }
示例#2
0
  /**
   * Fills the given list of all entities that intersect within the given bounding box that aren't
   * the passed entity Args: entity, aabb, listToFill
   */
  public void getEntitiesWithinAABBForEntity(
      Entity par1Entity,
      AxisAlignedBB par2AxisAlignedBB,
      List par3List,
      IEntitySelector par4IEntitySelector) {
    int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
    int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);

    if (var5 < 0) {
      var5 = 0;
      var6 = Math.max(var5, var6);
    }

    if (var6 >= this.entityLists.length) {
      var6 = this.entityLists.length - 1;
      var5 = Math.min(var5, var6);
    }

    for (int var7 = var5; var7 <= var6; ++var7) {
      List var8 = this.entityLists[var7];

      for (int var9 = 0; var9 < var8.size(); ++var9) {
        Entity var10 = (Entity) var8.get(var9);

        if (var10 != par1Entity
            && var10.boundingBox.intersectsWith(par2AxisAlignedBB)
            && (par4IEntitySelector == null || par4IEntitySelector.isEntityApplicable(var10))) {
          par3List.add(var10);
          Entity[] var11 = var10.getParts();

          if (var11 != null) {
            for (int var12 = 0; var12 < var11.length; ++var12) {
              var10 = var11[var12];

              if (var10 != par1Entity
                  && var10.boundingBox.intersectsWith(par2AxisAlignedBB)
                  && (par4IEntitySelector == null
                      || par4IEntitySelector.isEntityApplicable(var10))) {
                par3List.add(var10);
              }
            }
          }
        }
      }
    }
  }