Пример #1
0
  /**
   * Adds a AABB to the pool, or if there is an available AABB, updates an existing AABB entry to
   * specified coordinates
   */
  public AxisAlignedBB addOrModifyAABBInPool(
      double par1, double par3, double par5, double par7, double par9, double par11) {
    AxisAlignedBB var13;

    if (this.nextPoolIndex >= this.listAABB.size()) {
      var13 = new AxisAlignedBB(par1, par3, par5, par7, par9, par11);
      this.listAABB.add(var13);
    } else {
      var13 = (AxisAlignedBB) this.listAABB.get(this.nextPoolIndex);
      var13.setBounds(par1, par3, par5, par7, par9, par11);
    }

    ++this.nextPoolIndex;
    return var13;
  }
Пример #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);
 }
  /**
   * Looks for a sitting ocelot within certain bounds. Such an ocelot is considered to be blocking
   * access to the chest.
   */
  public static boolean isOcelotBlockingChest(World par0World, int par1, int par2, int par3) {
    Iterator var4 =
        par0World
            .getEntitiesWithinAABB(
                EntityOcelot.class,
                AxisAlignedBB.getAABBPool()
                    .addOrModifyAABBInPool(
                        (double) par1,
                        (double) (par2 + 1),
                        (double) par3,
                        (double) (par1 + 1),
                        (double) (par2 + 2),
                        (double) (par3 + 1)))
            .iterator();
    EntityOcelot var6;

    do {
      if (!var4.hasNext()) {
        return false;
      }

      EntityOcelot var5 = (EntityOcelot) var4.next();
      var6 = (EntityOcelot) var5;
    } while (!var6.isSitting());

    return true;
  }
Пример #4
0
 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);
       }
     }
   }
 }
Пример #5
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;
  }
  private static boolean func_72292_n(
      World p_72292_0_, int p_72292_1_, int p_72292_2_, int p_72292_3_) {
    Iterator var4 =
        p_72292_0_
            .func_72872_a(
                EntityOcelot.class,
                AxisAlignedBB.func_72332_a()
                    .func_72299_a(
                        (double) p_72292_1_,
                        (double) (p_72292_2_ + 1),
                        (double) p_72292_3_,
                        (double) (p_72292_1_ + 1),
                        (double) (p_72292_2_ + 2),
                        (double) (p_72292_3_ + 1)))
            .iterator();

    EntityOcelot var6;
    do {
      if (!var4.hasNext()) {
        return false;
      }

      EntityOcelot var5 = (EntityOcelot) var4.next();
      var6 = (EntityOcelot) var5;
    } while (!var6.func_70906_o());

    return true;
  }
Пример #7
0
  public AxisAlignedBB func_71872_e(
      World p_71872_1_, int p_71872_2_, int p_71872_3_, int p_71872_4_) {
    boolean var5 = this.func_72250_d(p_71872_1_, p_71872_2_, p_71872_3_, p_71872_4_ - 1);
    boolean var6 = this.func_72250_d(p_71872_1_, p_71872_2_, p_71872_3_, p_71872_4_ + 1);
    boolean var7 = this.func_72250_d(p_71872_1_, p_71872_2_ - 1, p_71872_3_, p_71872_4_);
    boolean var8 = this.func_72250_d(p_71872_1_, p_71872_2_ + 1, p_71872_3_, p_71872_4_);
    float var9 = 0.375F;
    float var10 = 0.625F;
    float var11 = 0.375F;
    float var12 = 0.625F;
    if (var5) {
      var11 = 0.0F;
    }

    if (var6) {
      var12 = 1.0F;
    }

    if (var7) {
      var9 = 0.0F;
    }

    if (var8) {
      var10 = 1.0F;
    }

    return AxisAlignedBB.func_72332_a()
        .func_72299_a(
            (double) ((float) p_71872_2_ + var9),
            (double) p_71872_3_,
            (double) ((float) p_71872_4_ + var11),
            (double) ((float) p_71872_2_ + var10),
            (double) ((float) p_71872_3_ + 1.5F),
            (double) ((float) p_71872_4_ + var12));
  }
Пример #8
0
  public void refreshRiders() {
    if (!this.isCeiling()) {
      AxisAlignedBB var1 = this.getBoundingBox().expand(0.0D, 0.3D, 0.0D);
      var1.minY += 0.3D;
      HashSet var2 = new HashSet();
      var2.addAll(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, var1));
      Iterator var3 = var2.iterator();

      while (var3.hasNext()) {
        Entity var4 = (Entity) var3.next();

        if (!this.mountedEntities.contains(var4)) {
          this.attemptMount(var4);
        }
      }
    }
  }
Пример #9
0
  @Override
  public void positionReached(EntityMechanicalArm arm) {
    inProcess = false;

    if (worldObj.isRemote) {
      return;
    }

    double[] targ = arm.getTarget();
    targetX = (int) targ[0];
    targetY = (int) targ[1];
    targetZ = (int) targ[2];

    int i = targetX;
    int j = targetY - 1;
    int k = targetZ;

    int blockId = worldObj.getBlockId(i, j, k);

    if (isQuarriableBlock(blockId, i, j, k)) {
      powerProvider.getTimeTracker().markTime(worldObj);

      // Share this with mining well!

      ArrayList<ItemStack> stacks = BuildCraftBlockUtil.getItemStackFromBlock(worldObj, i, j, k);

      if (stacks != null) {
        for (ItemStack s : stacks) {
          if (s != null) {
            mineStack(s);
          }
        }
      }

      worldObj.setBlockWithNotify(i, j, k, 0);
    }

    // Collect any lost items laying around
    double[] armHead = arm.getHead();
    AxisAlignedBB axis =
        AxisAlignedBB.getBoundingBox(
            armHead[0] - 1.5,
            armHead[1],
            armHead[2] - 1.5,
            armHead[0] + 2.5,
            armHead[1] + 2.5,
            armHead[2] + 2.5);
    List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis);
    for (int ii = 0; ii < result.size(); ii++) {
      if (result.get(ii) instanceof EntityItem) {
        EntityItem entity = (EntityItem) result.get(ii);
        if (entity.isDead) continue;
        if (entity.item.stackSize <= 0) continue;
        ProxyCore.proxy.removeEntity(entity);
        mineStack(entity.item);
      }
    }
  }
Пример #10
0
  private void addEffectsToPlayers() {
    if (this.isBeaconActive
        && this.levels > 0
        && !this.worldObj.isRemote
        && this.primaryEffect > 0) {
      double var1 = (double) (this.levels * 10 + 10);
      byte var3 = 0;

      if (this.levels >= 4 && this.primaryEffect == this.secondaryEffect) {
        var3 = 1;
      }

      AxisAlignedBB var4 =
          AxisAlignedBB.getAABBPool()
              .getAABB(
                  (double) this.xCoord,
                  (double) this.yCoord,
                  (double) this.zCoord,
                  (double) (this.xCoord + 1),
                  (double) (this.yCoord + 1),
                  (double) (this.zCoord + 1))
              .expand(var1, var1, var1);
      var4.maxY = (double) this.worldObj.getHeight();
      List var5 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, var4);
      Iterator var6 = var5.iterator();
      EntityPlayer var7;

      while (var6.hasNext()) {
        var7 = (EntityPlayer) var6.next();
        var7.addPotionEffect(new PotionEffect(this.primaryEffect, 180, var3, true));
      }

      if (this.levels >= 4
          && this.primaryEffect != this.secondaryEffect
          && this.secondaryEffect > 0) {
        var6 = var5.iterator();

        while (var6.hasNext()) {
          var7 = (EntityPlayer) var6.next();
          var7.addPotionEffect(new PotionEffect(this.secondaryEffect, 180, 0, true));
        }
      }
    }
  }
Пример #11
0
 /** returns the bounding box for this entity */
 public AxisAlignedBB getBoundingBox() {
   AxisAlignedBB var10000 = this.boundingBox;
   return AxisAlignedBB.getBoundingBox(
       this.posX - 0.5D,
       this.posY - 0.5D,
       this.posZ - 0.5D,
       this.posX + 0.5D,
       this.posY + 0.5D,
       this.posZ + 0.5D);
 }
Пример #12
0
  /**
   * Checks if the offset position from the entity's current position is inside of liquid. Args: x,
   * y, z
   */
  public boolean isOffsetPositionInLiquid(double par1, double par3, double par5) {
    AxisAlignedBB axisalignedbb = boundingBox.getOffsetBoundingBox(par1, par3, par5);
    List list = worldObj.getCollidingBoundingBoxes(this, axisalignedbb);

    if (list.size() > 0) {
      return false;
    }

    return !worldObj.isAnyLiquid(axisalignedbb);
  }
Пример #13
0
 public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int j, int k, int m) {
   float var5 = 0.0625F;
   return AxisAlignedBB.getAABBPool()
       .addOrModifyAABBInPool(
           (double) ((float) j + var5),
           (double) k,
           (double) ((float) m + var5),
           (double) ((float) (j + 1) - var5),
           (double) (k + 1),
           (double) ((float) (m + 1) - var5));
 }
Пример #14
0
 public AxisAlignedBB onFluidBoundingBoxCreation(Block var1, int var2, int var3, int var4) {
   double var5 = (double) var2;
   double var7 = (double) var3;
   double var9 = (double) var4;
   return AxisAlignedBB.getBoundingBox(
       var5 + var1.minX,
       var7 + var1.minY,
       var9 + var1.minZ,
       var5 + var1.maxX,
       var7 + var1.maxY - 0.2D,
       var9 + var1.maxZ);
 }
  public AxisAlignedBB func_72299_a(
      double p_72299_1_,
      double p_72299_3_,
      double p_72299_5_,
      double p_72299_7_,
      double p_72299_9_,
      double p_72299_11_) {
    AxisAlignedBB var13;
    if (this.field_72302_d >= this.field_72305_c.size()) {
      var13 =
          new AxisAlignedBB(
              p_72299_1_, p_72299_3_, p_72299_5_, p_72299_7_, p_72299_9_, p_72299_11_);
      this.field_72305_c.add(var13);
    } else {
      var13 = (AxisAlignedBB) this.field_72305_c.get(this.field_72302_d);
      var13.func_72324_b(p_72299_1_, p_72299_3_, p_72299_5_, p_72299_7_, p_72299_9_, p_72299_11_);
    }

    ++this.field_72302_d;
    return var13;
  }
Пример #16
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;
   }
 }
 public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) {
   int l = world.getBlockMetadata(i, j, k);
   float f = 0.0625F;
   float f1 = (float) (1 + l * 2) / 16F;
   float f2 = 0.5F;
   return AxisAlignedBB.getBoundingBoxFromPool(
       (float) i + f1,
       j,
       (float) k + f,
       (float) (i + 1) - f,
       ((float) j + f2) - f,
       (float) (k + 1) - f);
 }
Пример #18
0
  private void func_82535_o(World p_82535_1_, int p_82535_2_, int p_82535_3_, int p_82535_4_) {
    int var5 = p_82535_1_.func_72805_g(p_82535_2_, p_82535_3_, p_82535_4_);
    int var6 = var5 & 7;
    boolean var7 = (var5 & 8) != 0;
    this.func_82534_e(var5);
    List var9 =
        p_82535_1_.func_72872_a(
            EntityArrow.class,
            AxisAlignedBB.func_72332_a()
                .func_72299_a(
                    (double) p_82535_2_ + this.field_72026_ch,
                    (double) p_82535_3_ + this.field_72023_ci,
                    (double) p_82535_4_ + this.field_72024_cj,
                    (double) p_82535_2_ + this.field_72021_ck,
                    (double) p_82535_3_ + this.field_72022_cl,
                    (double) p_82535_4_ + this.field_72019_cm));
    boolean var8 = !var9.isEmpty();
    if (var8 && !var7) {
      p_82535_1_.func_72921_c(p_82535_2_, p_82535_3_, p_82535_4_, var6 | 8, 3);
      this.func_82536_d(p_82535_1_, p_82535_2_, p_82535_3_, p_82535_4_, var6);
      p_82535_1_.func_72909_d(
          p_82535_2_, p_82535_3_, p_82535_4_, p_82535_2_, p_82535_3_, p_82535_4_);
      p_82535_1_.func_72908_a(
          (double) p_82535_2_ + 0.5D,
          (double) p_82535_3_ + 0.5D,
          (double) p_82535_4_ + 0.5D,
          "random.click",
          0.3F,
          0.6F);
    }

    if (!var8 && var7) {
      p_82535_1_.func_72921_c(p_82535_2_, p_82535_3_, p_82535_4_, var6, 3);
      this.func_82536_d(p_82535_1_, p_82535_2_, p_82535_3_, p_82535_4_, var6);
      p_82535_1_.func_72909_d(
          p_82535_2_, p_82535_3_, p_82535_4_, p_82535_2_, p_82535_3_, p_82535_4_);
      p_82535_1_.func_72908_a(
          (double) p_82535_2_ + 0.5D,
          (double) p_82535_3_ + 0.5D,
          (double) p_82535_4_ + 0.5D,
          "random.click",
          0.3F,
          0.5F);
    }

    if (var8) {
      p_82535_1_.func_72836_a(
          p_82535_2_, p_82535_3_, p_82535_4_, this.field_71990_ca, this.func_71859_p_(p_82535_1_));
    }
  }
Пример #19
0
 /**
  * Returns a bounding box from the pool of bounding boxes (this means this box can change after
  * the pool has been cleared to be reused)
  */
 public AxisAlignedBB getCollisionBoundingBoxFromPool(
     World par1World, int par2, int par3, int par4) {
   int var5 = par1World.getBlockMetadata(par2, par3, par4) & 7;
   return var5 >= 3
       ? AxisAlignedBB.getAABBPool()
           .addOrModifyAABBInPool(
               (double) par2 + this.minX,
               (double) par3 + this.minY,
               (double) par4 + this.minZ,
               (double) par2 + this.maxX,
               (double) ((float) par3 + 0.5F),
               (double) par4 + this.maxZ)
       : null;
 }
Пример #20
0
 /**
  * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box.
  */
 public void setPosition(double par1, double par3, double par5) {
   posX = par1;
   posY = par3;
   posZ = par5;
   float f = width / 2.0F;
   float f1 = height;
   boundingBox.setBounds(
       par1 - (double) f,
       (par3 - (double) yOffset) + (double) ySize,
       par5 - (double) f,
       par1 + (double) f,
       (par3 - (double) yOffset) + (double) ySize + (double) f1,
       par5 + (double) f);
 }
Пример #21
0
 /**
  * Returns a bounding box from the pool of bounding boxes (this means this box can change after
  * the pool has been cleared to be reused)
  */
 public AxisAlignedBB getCollisionBoundingBoxFromPool(
     World par1World, int par2, int par3, int par4) {
   int var5 = this.GetEatState(par1World, par2, par3, par4);
   float var6 = 0.0625F;
   float var7 = (float) (1 + var5 * 2) / 16.0F;
   float var8 = 0.5F;
   return AxisAlignedBB.getAABBPool()
       .addOrModifyAABBInPool(
           (double) ((float) par2 + var7),
           (double) par3,
           (double) ((float) par4 + var6),
           (double) ((float) (par2 + 1) - var6),
           (double) ((float) par3 + var8 - var6),
           (double) ((float) (par4 + 1) - var6));
 }
Пример #22
0
  // Ceci est pour passer à travers le bloc. Enlevez-le si vous ne vous les pas avoir un effet
  // "noclip".
  public AxisAlignedBB getCollisionBoundingBoxFromPool(
      World par1World, int par2, int par3, int par4) {
    int i = par1World.getBlockMetadata(par2, par3, par4) & 7;

    if (i >= 3) {
      return AxisAlignedBB.getBoundingBoxFromPool(
          (double) par2 + minX,
          (double) par3 + minY,
          (double) par4 + minZ,
          (double) par2 + maxX,
          (float) par3 + 0.5F,
          (double) par4 + maxZ);
    } else {
      return null;
    }
  }
Пример #23
0
 public void func_28002_e() {
   try {
     field_28006_b = new byte[0];
     renderGlobal.func_28137_f();
   } catch (Throwable throwable) {
   }
   try {
     System.gc();
     AxisAlignedBB.func_28196_a();
     Vec3D.func_28215_a();
   } catch (Throwable throwable1) {
   }
   try {
     System.gc();
     changeWorld1(null);
   } catch (Throwable throwable2) {
   }
   System.gc();
 }
Пример #24
0
  private void func_82124_t() {
    if (this.field_82135_d
        && this.field_82136_e > 0
        && !this.field_70331_k.field_72995_K
        && this.field_82133_f > 0) {
      double var1 = (double) (this.field_82136_e * 8 + 8);
      byte var3 = 0;
      if (this.field_82136_e >= 4 && this.field_82133_f == this.field_82134_g) {
        var3 = 1;
      }

      AxisAlignedBB var4 =
          AxisAlignedBB.func_72332_a()
              .func_72299_a(
                  (double) this.field_70329_l,
                  (double) this.field_70330_m,
                  (double) this.field_70327_n,
                  (double) (this.field_70329_l + 1),
                  (double) (this.field_70330_m + 1),
                  (double) (this.field_70327_n + 1))
              .func_72314_b(var1, var1, var1);
      List var5 = this.field_70331_k.func_72872_a(EntityPlayer.class, var4);
      Iterator var6 = var5.iterator();

      EntityPlayer var7;
      while (var6.hasNext()) {
        var7 = (EntityPlayer) var6.next();
        var7.func_70690_d(new PotionEffect(this.field_82133_f, 180, var3, true));
      }

      if (this.field_82136_e >= 4
          && this.field_82133_f != this.field_82134_g
          && this.field_82134_g > 0) {
        var6 = var5.iterator();

        while (var6.hasNext()) {
          var7 = (EntityPlayer) var6.next();
          var7.func_70690_d(new PotionEffect(this.field_82134_g, 180, 0, true));
        }
      }
    }
  }
Пример #25
0
  /**
   * Called when the player attack or gets attacked, it's alert all wolves in the area that are
   * owned by the player to join the attack or defend the player.
   */
  protected void alertWolves(EntityLiving par1EntityLiving, boolean par2) {
    if (!(par1EntityLiving instanceof EntityCreeper)
        && !(par1EntityLiving instanceof EntityGhast)) {
      if (par1EntityLiving instanceof EntityWolf) {
        EntityWolf var3 = (EntityWolf) par1EntityLiving;

        if (var3.isTamed() && this.username.equals(var3.getOwnerName())) {
          return;
        }
      }

      if (!(par1EntityLiving instanceof EntityPlayer) || this.isPVPEnabled()) {
        List var7 =
            this.worldObj.getEntitiesWithinAABB(
                EntityWolf.class,
                AxisAlignedBB.getBoundingBoxFromPool(
                        this.posX,
                        this.posY,
                        this.posZ,
                        this.posX + 1.0D,
                        this.posY + 1.0D,
                        this.posZ + 1.0D)
                    .expand(16.0D, 4.0D, 16.0D));
        Iterator var4 = var7.iterator();

        while (var4.hasNext()) {
          Entity var5 = (Entity) var4.next();
          EntityWolf var6 = (EntityWolf) var5;

          if (var6.isTamed()
              && var6.getEntityToAttack() == null
              && this.username.equals(var6.getOwnerName())
              && (!par2 || !var6.isSitting())) {
            var6.setSitting(false);
            var6.setTarget(par1EntityLiving);
          }
        }
      }
    }
  }
Пример #26
0
  /**
   * Sets the position and rotation. Only difference from the other one is no bounding on the
   * rotation. Args: posX, posY, posZ, yaw, pitch
   */
  public void setPositionAndRotation2(
      double par1, double par3, double par5, float par7, float par8, int par9) {
    setPosition(par1, par3, par5);
    setRotation(par7, par8);
    List list =
        worldObj.getCollidingBoundingBoxes(this, boundingBox.contract(0.03125D, 0.0D, 0.03125D));

    if (list.size() > 0) {
      double d = 0.0D;

      for (int i = 0; i < list.size(); i++) {
        AxisAlignedBB axisalignedbb = (AxisAlignedBB) list.get(i);

        if (axisalignedbb.maxY > d) {
          d = axisalignedbb.maxY;
        }
      }

      par3 += d - boundingBox.minY;
      setPosition(par1, par3, par5);
    }
  }
Пример #27
0
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    super.onLivingUpdate();
    if (entityToAttack == null && !hasPath() && worldObj.rand.nextInt(100) == 0 && fixai) {
      List list =
          worldObj.getEntitiesWithinAABB(
              net.minecraft.src.EntityMob.class,
              AxisAlignedBB.getBoundingBoxFromPool(
                      posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D)
                  .expand(16D, 4D, 16D));
      if (!list.isEmpty()) {
        setTarget((Entity) list.get(worldObj.rand.nextInt(list.size())));
      }
    }

    if (isWet()) {
      attackEntityFrom(DamageSource.drown, 1);
    }

    int i = MathHelper.floor_double(posX);
    int k = MathHelper.floor_double(posZ);

    if (worldObj.getBiomeGenForCoords(i, k).getFloatTemperature() > 1.0F) {
      attackEntityFrom(DamageSource.onFire, 1);
    }

    for (int j = 0; j < 4; j++) {
      int l = MathHelper.floor_double(posX + (double) ((float) ((j % 2) * 2 - 1) * 0.25F));
      int i1 = MathHelper.floor_double(posY);
      int j1 = MathHelper.floor_double(posZ + (double) ((float) (((j / 2) % 2) * 2 - 1) * 0.25F));

      if (worldObj.getBlockId(l, i1, j1) == 0
          && worldObj.getBiomeGenForCoords(l, j1).getFloatTemperature() < 0.8F
          && Block.snow.canPlaceBlockAt(worldObj, l, i1, j1)) {
        worldObj.setBlockWithNotify(l, i1, j1, Block.snow.blockID);
      }
    }
  }
Пример #28
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);
  }
Пример #29
0
 /** Whether or not the current entity is in lava */
 public boolean handleLavaMovement() {
   return worldObj.isMaterialInBB(boundingBox.expand(-0.1D, -0.4D, -0.1D), Material.lava);
 }
Пример #30
0
 /** Returns if this entity is in water and will end up adding the waters velocity to the entity */
 public boolean handleWaterMovement() {
   return worldObj.handleMaterialAcceleration(
       boundingBox.expand(0.0D, -0.4D, 0.0D), Material.water, this);
 }