예제 #1
0
  /**
   * Returns true if the block is emitting indirect/weak redstone power on the specified side. If
   * isBlockNormalCube returns true, standard redstone propagation rules will apply instead and this
   * will not be called. Args: World, X, Y, Z, side
   */
  public boolean isProvidingWeakPower(
      IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
    if (!this.wiresProvidePower) {
      return false;
    } else if (par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 0) {
      return false;
    } else if (par5 == 1) {
      return true;
    } else {
      boolean var6 =
          isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3, par4, 1)
              || !par1IBlockAccess.isBlockNormalCube(par2 - 1, par3, par4)
                  && isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3 - 1, par4, -1);
      boolean var7 =
          isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3, par4, 3)
              || !par1IBlockAccess.isBlockNormalCube(par2 + 1, par3, par4)
                  && isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3 - 1, par4, -1);
      boolean var8 =
          isPoweredOrRepeater(par1IBlockAccess, par2, par3, par4 - 1, 2)
              || !par1IBlockAccess.isBlockNormalCube(par2, par3, par4 - 1)
                  && isPoweredOrRepeater(par1IBlockAccess, par2, par3 - 1, par4 - 1, -1);
      boolean var9 =
          isPoweredOrRepeater(par1IBlockAccess, par2, par3, par4 + 1, 0)
              || !par1IBlockAccess.isBlockNormalCube(par2, par3, par4 + 1)
                  && isPoweredOrRepeater(par1IBlockAccess, par2, par3 - 1, par4 + 1, -1);

      if (!par1IBlockAccess.isBlockNormalCube(par2, par3 + 1, par4)) {
        if (par1IBlockAccess.isBlockNormalCube(par2 - 1, par3, par4)
            && isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3 + 1, par4, -1)) {
          var6 = true;
        }

        if (par1IBlockAccess.isBlockNormalCube(par2 + 1, par3, par4)
            && isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3 + 1, par4, -1)) {
          var7 = true;
        }

        if (par1IBlockAccess.isBlockNormalCube(par2, par3, par4 - 1)
            && isPoweredOrRepeater(par1IBlockAccess, par2, par3 + 1, par4 - 1, -1)) {
          var8 = true;
        }

        if (par1IBlockAccess.isBlockNormalCube(par2, par3, par4 + 1)
            && isPoweredOrRepeater(par1IBlockAccess, par2, par3 + 1, par4 + 1, -1)) {
          var9 = true;
        }
      }

      return !var8 && !var7 && !var6 && !var9 && par5 >= 2 && par5 <= 5
          ? true
          : (par5 == 2 && var8 && !var6 && !var7
              ? true
              : (par5 == 3 && var9 && !var6 && !var7
                  ? true
                  : (par5 == 4 && var6 && !var8 && !var9
                      ? true
                      : par5 == 5 && var7 && !var8 && !var9)));
    }
  }