コード例 #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
  public void func_76618_a(Class p_76618_1_, AxisAlignedBB p_76618_2_, List p_76618_3_) {
    int var4 = MathHelper.func_76128_c((p_76618_2_.field_72338_b - 2.0D) / 16.0D);
    int var5 = MathHelper.func_76128_c((p_76618_2_.field_72337_e + 2.0D) / 16.0D);
    if (var4 < 0) {
      var4 = 0;
    } else if (var4 >= this.field_76645_j.length) {
      var4 = this.field_76645_j.length - 1;
    }

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

    for (int var6 = var4; var6 <= var5; ++var6) {
      List var7 = this.field_76645_j[var6];
      Iterator var8 = var7.iterator();

      while (var8.hasNext()) {
        Entity var9 = (Entity) var8.next();
        if (p_76618_1_.isAssignableFrom(var9.getClass())
            && var9.field_70121_D.func_72326_a(p_76618_2_)) {
          p_76618_3_.add(var9);
        }
      }
    }
  }
コード例 #3
0
ファイル: MapCalculator.java プロジェクト: Top-Cat/Spoutcraft
 private void entityCalc() {
   synchronized (map.watchedEntities) {
     map.watchedEntities.clear();
     if (!Spoutcraft.hasPermission("spout.plugin.minimap.showentities")) {
       return;
     }
     if (!MinimapConfig.getInstance().isShowingEntities()) {
       return;
     }
     int radius = map.renderSize / 2;
     double playerX = map.getPlayerX();
     double playerZ = map.getPlayerZ();
     for (Object ob :
         SpoutClient.getHandle()
             .theWorld
             .getEntitiesWithinAABB(
                 EntityLiving.class,
                 AxisAlignedBB.getBoundingBox(
                     playerX - radius,
                     0,
                     playerZ - radius,
                     playerX + radius,
                     256,
                     playerZ + radius))) {
       net.minecraft.src.Entity e = (net.minecraft.src.Entity) ob;
       if (!MinimapConfig.getInstance().isEntityVisible(e.getClass())) {
         continue;
       }
       WatchedEntity w = new WatchedEntity(e);
       if (w.getTexture() != null) {
         map.watchedEntities.add(w);
       }
     }
   }
 }
コード例 #4
0
ファイル: EntityAnimalTFC.java プロジェクト: shepheb/TFCraft
 public boolean attackEntityfrom(DamageSource par1DamageSource, int par2) {
   Entity entity = par1DamageSource.getEntity();
   fearSource = par1DamageSource.getEntity();
   // System.out.println("yep");
   if (entity.getClass() == getClass() && (((EntityAnimalTFC) entity).rutting)) {
     setAttackTarget((EntityLiving) entity);
     if (getHealth() <= getMaxHealth() / 4) {
       ((EntityAnimalTFC) getAttackTarget()).ruttVictor = true;
     }
   }
   if (isChild()
       && parent.children.contains(this)
       && par1DamageSource.getEntity() instanceof EntityLiving) {
     parent.setAttackTarget((EntityLiving) par1DamageSource.getEntity());
   }
   return super.attackEntityFrom(par1DamageSource, par2);
 }
コード例 #5
0
ファイル: Chunk.java プロジェクト: talmor/WorldDownloader
 public void getEntitiesOfTypeWithinAAAB(Class class1, AxisAlignedBB axisalignedbb, List list) {
   int i = MathHelper.floor_double((axisalignedbb.minY - 2D) / 16D);
   int j = MathHelper.floor_double((axisalignedbb.maxY + 2D) / 16D);
   if (i < 0) {
     i = 0;
   }
   if (j >= entities.length) {
     j = entities.length - 1;
   }
   for (int k = i; k <= j; k++) {
     List list1 = entities[k];
     for (int l = 0; l < list1.size(); l++) {
       Entity entity = (Entity) list1.get(l);
       if (class1.isAssignableFrom(entity.getClass())
           && entity.boundingBox.intersectsWith(axisalignedbb)) {
         list.add(entity);
       }
     }
   }
 }
コード例 #6
0
 public void func_1013_a(Class class1, AxisAlignedBB axisalignedbb, List list) {
   int i = MathHelper.func_1108_b((axisalignedbb.field_1697_b - 2D) / 16D);
   int j = MathHelper.func_1108_b((axisalignedbb.field_1702_e + 2D) / 16D);
   if (i < 0) {
     i = 0;
   } else if (i >= field_1528_m.length) {
     i = field_1528_m.length - 1;
   }
   if (j >= field_1528_m.length) {
     j = field_1528_m.length - 1;
   } else if (j < 0) {
     j = 0;
   }
   for (int k = i; k <= j; k++) {
     List list1 = field_1528_m[k];
     for (int l = 0; l < list1.size(); l++) {
       Entity entity = (Entity) list1.get(l);
       if (class1.isAssignableFrom(entity.getClass())
           && entity.field_601_au.func_1178_a(axisalignedbb)) {
         list.add(entity);
       }
     }
   }
 }
コード例 #7
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();
  }
コード例 #8
0
ファイル: EntityList.java プロジェクト: Rob4001/UMC-Client
 /** gets the string representation of a specific entity */
 public static String getEntityString(Entity par0Entity) {
   return (String) classToStringMapping.get(par0Entity.getClass());
 }
コード例 #9
0
ファイル: EntityList.java プロジェクト: Rob4001/UMC-Client
 /** gets the entityID of a specific entity */
 public static int getEntityID(Entity par0Entity) {
   return ((Integer) classToIDMapping.get(par0Entity.getClass())).intValue();
 }
コード例 #10
0
ファイル: RenderManager.java プロジェクト: Kasoo/Spoutcraft
 public Render getEntityRenderObject(Entity par1Entity) {
   return this.getEntityClassRenderObject(par1Entity.getClass());
 }
コード例 #11
0
 /** gets the entityID of a specific entity */
 public static int getEntityID(Entity par0Entity) {
   Class var1 = par0Entity.getClass();
   return classToIDMapping.containsKey(var1)
       ? ((Integer) classToIDMapping.get(var1)).intValue()
       : 0;
 }
コード例 #12
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 (this.anyPlayerInRange()) {
      if (this.worldObj.isRemote) {
        double var1 = (double) ((float) this.xCoord + this.worldObj.rand.nextFloat());
        double var3 = (double) ((float) this.yCoord + this.worldObj.rand.nextFloat());
        double var5 = (double) ((float) this.zCoord + this.worldObj.rand.nextFloat());
        this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
        this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);

        if (this.delay > 0) {
          --this.delay;
        }

        this.yaw2 = this.yaw;
        this.yaw = (this.yaw + (double) (1000.0F / ((float) this.delay + 200.0F))) % 360.0D;
      } else {
        if (this.delay == -1) {
          this.updateDelay();
        }

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

        for (int var11 = 0; var11 < this.spawnCount; ++var11) {
          Entity var2 = EntityList.createEntityByName(this.mobID, this.worldObj);

          if (var2 == null) {
            return;
          }

          int var12 =
              this.worldObj
                  .getEntitiesWithinAABB(
                      var2.getClass(),
                      AxisAlignedBB.getAABBPool()
                          .addOrModifyAABBInPool(
                              (double) this.xCoord,
                              (double) this.yCoord,
                              (double) this.zCoord,
                              (double) (this.xCoord + 1),
                              (double) (this.yCoord + 1),
                              (double) (this.zCoord + 1))
                          .expand(
                              (double) (this.field_82348_s * 2),
                              4.0D,
                              (double) (this.field_82348_s * 2)))
                  .size();

          if (var12 >= this.field_82350_j) {
            this.updateDelay();
            return;
          }

          if (var2 != null) {
            double var4 =
                (double) this.xCoord
                    + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble())
                        * (double) this.field_82348_s;
            double var6 = (double) (this.yCoord + this.worldObj.rand.nextInt(3) - 1);
            double var8 =
                (double) this.zCoord
                    + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble())
                        * (double) this.field_82348_s;
            EntityLiving var10 = var2 instanceof EntityLiving ? (EntityLiving) var2 : null;
            var2.setLocationAndAngles(
                var4, var6, var8, this.worldObj.rand.nextFloat() * 360.0F, 0.0F);

            if (var10 == null || var10.getCanSpawnHere()) {
              this.writeNBTTagsTo(var2);
              this.worldObj.spawnEntityInWorld(var2);
              this.worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);

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

              this.updateDelay();
            }
          }
        }
      }

      super.updateEntity();
    }
  }