예제 #1
0
  /**
   * calculateFlowCost(World world, int x, int y, int z, int accumulatedCost, int
   * previousDirectionOfFlow) - Used to determine the path of least resistance, this method returns
   * the lowest possible flow cost for the direction of flow indicated. Each necessary horizontal
   * flow adds to the flow cost.
   */
  private int calculateFlowCost(World par1World, int par2, int par3, int par4, int par5, int par6) {
    int var7 = 1000;

    for (int var8 = 0; var8 < 4; ++var8) {
      if ((var8 != 0 || par6 != 1)
          && (var8 != 1 || par6 != 0)
          && (var8 != 2 || par6 != 3)
          && (var8 != 3 || par6 != 2)) {
        int var9 = par2;
        int var11 = par4;

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

        if (var8 == 1) {
          ++var9;
        }

        if (var8 == 2) {
          var11 = par4 - 1;
        }

        if (var8 == 3) {
          ++var11;
        }

        if (!this.blockBlocksFlow(par1World, var9, par3, var11)
            && ((par1World.getBlockMaterial(var9, par3, var11) != this.blockMaterial /*||
                		par1World.getBlockId(var9, par3, var11) == this.blockID) || par1World.getBlockMetadata(var9, par3, var11) != 0*/))) {
          if (!this.blockBlocksFlow(par1World, var9, par3 - 1, var11)) {
            return par5;
          }

          if (par5 < 4) {
            int var12 = this.calculateFlowCost(par1World, var9, par3, var11, par5 + 1, var8);

            if (var12 < var7) {
              var7 = var12;
            }
          }
        }
      }
    }

    return var7;
  }
예제 #2
0
 /** Returns true if the block at the coordinates can be displaced by the liquid. */
 private boolean liquidCanDisplaceBlock(World par1World, int par2, int par3, int par4) {
   Material material = par1World.getBlockMaterial(par2, par3, par4);
   return material == this.blockMaterial
       ? true
       : (material == Material.lava ? false : !this.blockBlocksFlow(par1World, par2, par3, par4));
 }