예제 #1
0
  @SideOnly(Side.CLIENT)

  /** Return Vec3D with biome specific fog color */
  public Vec3 getFogColor(float par1, float par2) {
    return Vec3.getVec3Pool()
        .getVecFromPool(0.20000000298023224D, 0.029999999329447746D, 0.029999999329447746D);
  }
예제 #2
0
 protected MovingObjectPosition getMovingObjectPositionFromPlayer(
     World par1World, EntityPlayer par2EntityPlayer, boolean par3) {
   float var4 = 1.0F;
   float var5 =
       par2EntityPlayer.prevRotationPitch
           + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
   float var6 =
       par2EntityPlayer.prevRotationYaw
           + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
   double var7 =
       par2EntityPlayer.prevPosX
           + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double) var4;
   double var9 =
       par2EntityPlayer.prevPosY
           + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double) var4
           + 1.62D
           - (double) par2EntityPlayer.yOffset;
   double var11 =
       par2EntityPlayer.prevPosZ
           + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double) var4;
   Vec3 var13 = Vec3.getVec3Pool().getVecFromPool(var7, var9, var11);
   float var14 = MathHelper.cos(-var6 * 0.017453292F - (float) Math.PI);
   float var15 = MathHelper.sin(-var6 * 0.017453292F - (float) Math.PI);
   float var16 = -MathHelper.cos(-var5 * 0.017453292F);
   float var17 = MathHelper.sin(-var5 * 0.017453292F);
   float var18 = var15 * var16;
   float var20 = var14 * var16;
   double var21 = 5.0D;
   if (par2EntityPlayer instanceof EntityPlayerMP) {
     var21 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance();
   }
   Vec3 var23 =
       var13.addVector((double) var18 * var21, (double) var17 * var21, (double) var20 * var21);
   return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
 }
예제 #3
0
  /** Returns a vector indicating the direction and intensity of fluid flow. */
  private Vec3 getFlowVector(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
    Vec3 var5 = Vec3.getVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D);
    int var6 = this.getEffectiveFlowDecay(par1IBlockAccess, par2, par3, par4);

    for (int var7 = 0; var7 < 4; ++var7) {
      int var8 = par2;
      int var10 = par4;

      if (var7 == 0) {
        var8 = par2 - 1;
      }

      if (var7 == 1) {
        var10 = par4 - 1;
      }

      if (var7 == 2) {
        ++var8;
      }

      if (var7 == 3) {
        ++var10;
      }

      int var11 = this.getEffectiveFlowDecay(par1IBlockAccess, var8, par3, var10);
      int var12;

      if (var11 < 0) {
        if (!par1IBlockAccess.getBlockMaterial(var8, par3, var10).blocksMovement()) {
          var11 = this.getEffectiveFlowDecay(par1IBlockAccess, var8, par3 - 1, var10);

          if (var11 >= 0) {
            var12 = var11 - (var6 - 8);
            var5 =
                var5.addVector(
                    (double) ((var8 - par2) * var12),
                    (double) ((par3 - par3) * var12),
                    (double) ((var10 - par4) * var12));
          }
        }
      } else if (var11 >= 0) {
        var12 = var11 - var6;
        var5 =
            var5.addVector(
                (double) ((var8 - par2) * var12),
                (double) ((par3 - par3) * var12),
                (double) ((var10 - par4) * var12));
      }
    }

    if (par1IBlockAccess.getBlockMetadata(par2, par3, par4) >= 8) {
      boolean var13 = false;

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3, par4 - 1, 2)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3, par4 + 1, 3)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2 - 1, par3, par4, 4)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2 + 1, par3, par4, 5)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3 + 1, par4 - 1, 2)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3 + 1, par4 + 1, 3)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2 - 1, par3 + 1, par4, 4)) {
        var13 = true;
      }

      if (var13 || this.isBlockSolid(par1IBlockAccess, par2 + 1, par3 + 1, par4, 5)) {
        var13 = true;
      }

      if (var13) {
        var5 = var5.normalize().addVector(0.0D, -6.0D, 0.0D);
      }
    }

    var5 = var5.normalize();
    return var5;
  }
  /** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    if (this.targetEntityClass == EntityPlayer.class) {
      if (this.theEntity instanceof EntityTameable && ((EntityTameable) this.theEntity).isTamed()) {
        return false;
      }

      this.closestLivingEntity =
          this.theEntity.worldObj.getClosestPlayerToEntity(
              this.theEntity, (double) this.distanceFromEntity);

      if (this.closestLivingEntity == null) {
        return false;
      }
    } else {
      List var1 =
          this.theEntity.worldObj.getEntitiesWithinAABB(
              this.targetEntityClass,
              this.theEntity.boundingBox.expand(
                  (double) this.distanceFromEntity, 3.0D, (double) this.distanceFromEntity));

      if (var1.isEmpty()) {
        return false;
      }

      this.closestLivingEntity = (Entity) var1.get(0);
    }

    if (!this.theEntity.getEntitySenses().canSee(this.closestLivingEntity)) {
      return false;
    } else {
      Vec3 var2 =
          RandomPositionGenerator.findRandomTargetBlockAwayFrom(
              this.theEntity,
              16,
              7,
              Vec3.getVec3Pool()
                  .getVecFromPool(
                      this.closestLivingEntity.posX,
                      this.closestLivingEntity.posY,
                      this.closestLivingEntity.posZ));

      if (var2 == null) {
        return false;
      } else if (this.closestLivingEntity.getDistanceSq(var2.xCoord, var2.yCoord, var2.zCoord)
          < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) {
        return false;
      } else {
        if (!this.isMagicEffect) {
          this.entityPathEntity =
              this.entityPathNavigate.getPathToXYZ(var2.xCoord, var2.yCoord, var2.zCoord);
          return this.entityPathEntity == null
              ? false
              : this.entityPathEntity.isDestinationSame(var2);
        } else {
          if (this.theEntity.isPotionActive(Potion.flee)) {
            this.entityPathEntity =
                this.entityPathNavigate.getPathToXYZ(var2.xCoord, var2.yCoord, var2.zCoord);
            return this.entityPathEntity == null
                ? false
                : this.entityPathEntity.isDestinationSame(var2);
          } else {
            return false;
          }
        }
      }
    }
  }