示例#1
0
 private boolean isEastStackValid(World world, int x, int y, int z) {
   if (((world.getBlock(x, y, z).getMaterial() == Material.rock
               || world.getBlock(x, y, z).getMaterial() == Material.iron)
           && world.getBlock(x, y, z).isNormalCube())
       || TFC_Core.isWestFaceSolid(
           world, x, y,
           z)) // Since its the East Block, we need to make sure the West side facing the stack is
               // solid
   {
     return true;
   }
   return false;
 }
示例#2
0
  private boolean checkVertical(World world, int x, int y, int z, boolean flip) {
    int dir = world.getBlockMetadata(x, y, z) & 3;

    if (flip) dir = flipDir(dir);

    boolean b = false;
    boolean t = false;
    if ((world.getBlock(x, y - 1, z).getMaterial() == Material.rock
            || world.getBlock(x, y - 1, z).getMaterial() == Material.iron)
        && world.getBlock(x, y - 1, z).isOpaqueCube()) b = true;

    if (!b && world.getBlock(x, y - 1, z) == TFCBlocks.Detailed
        || world.getBlock(x, y - 1, z) == TFCBlocks.stoneSlabs) {
      switch (dir) {
        case 0:
          if (TFC_Core.isNorthFaceSolid(world, x, y - 1, z)
              && TFC_Core.isEastFaceSolid(world, x, y - 1, z)
              && TFC_Core.isWestFaceSolid(world, x, y - 1, z)) b = true;
          break;
        case 1:
          if (TFC_Core.isEastFaceSolid(world, x, y - 1, z)
              && TFC_Core.isNorthFaceSolid(world, x, y - 1, z)
              && TFC_Core.isSouthFaceSolid(world, x, y - 1, z)) b = true;
          break;
        case 2:
          if (TFC_Core.isSouthFaceSolid(world, x, y - 1, z)
              && TFC_Core.isEastFaceSolid(world, x, y - 1, z)
              && TFC_Core.isWestFaceSolid(world, x, y - 1, z)) b = true;
          break;
        case 3:
          if (TFC_Core.isWestFaceSolid(world, x, y - 1, z)
              && TFC_Core.isNorthFaceSolid(world, x, y - 1, z)
              && TFC_Core.isSouthFaceSolid(world, x, y - 1, z)) b = true;
          break;
      }

      if (!TFC_Core.isTopFaceSolid(world, x, y - 1, z)) b = false;
    }

    if ((world.getBlock(x, y + 1, z).getMaterial() == Material.rock
            || world.getBlock(x, y + 1, z).getMaterial() == Material.iron)
        && world.getBlock(x, y + 1, z).isOpaqueCube()) t = true;

    if (!t && world.getBlock(x, y + 1, z) == TFCBlocks.Detailed
        || world.getBlock(x, y + 1, z) == TFCBlocks.stoneSlabs) {
      switch (dir) {
        case 0:
          if (TFC_Core.isNorthFaceSolid(world, x, y + 1, z)
              && TFC_Core.isEastFaceSolid(world, x, y + 1, z)
              && TFC_Core.isWestFaceSolid(world, x, y + 1, z)) t = true;
          break;
        case 1:
          if (TFC_Core.isEastFaceSolid(world, x, y + 1, z)
              && TFC_Core.isNorthFaceSolid(world, x, y + 1, z)
              && TFC_Core.isSouthFaceSolid(world, x, y + 1, z)) t = true;
          break;
        case 2:
          if (TFC_Core.isSouthFaceSolid(world, x, y + 1, z)
              && TFC_Core.isEastFaceSolid(world, x, y + 1, z)
              && TFC_Core.isWestFaceSolid(world, x, y + 1, z)) t = true;
          break;
        case 3:
          if (TFC_Core.isWestFaceSolid(world, x, y + 1, z)
              && TFC_Core.isNorthFaceSolid(world, x, y + 1, z)
              && TFC_Core.isSouthFaceSolid(world, x, y + 1, z)) t = true;
          break;
      }

      if (!TFC_Core.isBottomFaceSolid(world, x, y + 1, z)
          || !TFC_Core.isTopFaceSolid(world, x, y + 1, z)) t = false;
    }

    if (b && t) return true;

    return false;
  }
示例#3
0
  private boolean checkHorizontal(World world, int x, int y, int z, boolean flip) {
    int dir = world.getBlockMetadata(x, y, z) & 3;

    if (flip) dir = flipDir(dir);

    int[] map = sidesMap[dir];

    boolean l = false;
    boolean r = false;
    if ((world.getBlock(x - map[0], y, z - map[1]).getMaterial() == Material.rock
            || world.getBlock(x - map[0], y, z - map[1]).getMaterial() == Material.iron)
        && world.getBlock(x - map[0], y, z - map[1]).isOpaqueCube()) l = true;

    if (!l && world.getBlock(x - map[0], y, z - map[1]) == TFCBlocks.Detailed
        || world.getBlock(x - map[0], y, z - map[1]) == TFCBlocks.stoneSlabs) {
      switch (dir) {
        case 0:
          if (TFC_Core.isNorthFaceSolid(world, x - map[0], y, z - map[1])
              && TFC_Core.isEastFaceSolid(world, x - map[0], y, z - map[1])) l = true;
          break;
        case 1:
          if (TFC_Core.isEastFaceSolid(world, x - map[0], y, z - map[1])
              && TFC_Core.isSouthFaceSolid(world, x - map[0], y, z - map[1])) l = true;
          break;
        case 2:
          if (TFC_Core.isSouthFaceSolid(world, x - map[0], y, z - map[1])
              && TFC_Core.isEastFaceSolid(world, x - map[0], y, z - map[1])) l = true;
          break;
        case 3:
          if (TFC_Core.isWestFaceSolid(world, x - map[0], y, z - map[1])
              && TFC_Core.isSouthFaceSolid(world, x - map[0], y, z - map[1])) l = true;
          break;
      }

      if (!TFC_Core.isBottomFaceSolid(world, x - map[0], y, z - map[1])) l = false;
      if (!TFC_Core.isTopFaceSolid(world, x - map[0], y, z - map[1])) l = false;
    }

    if ((world.getBlock(x + map[0], y, z + map[1]).getMaterial() == Material.rock
            || world.getBlock(x + map[0], y, z + map[1]).getMaterial() == Material.iron)
        && world.getBlock(x + map[0], y, z + map[1]).isOpaqueCube()) r = true;

    if (!r && world.getBlock(x + map[0], y, z + map[1]) == TFCBlocks.Detailed
        || world.getBlock(x + map[0], y, z + map[1]) == TFCBlocks.stoneSlabs) {
      switch (dir) {
        case 0:
          if (TFC_Core.isNorthFaceSolid(world, x + map[0], y, z + map[1])
              && TFC_Core.isWestFaceSolid(world, x + map[0], y, z + map[1])) r = true;
          break;
        case 1:
          if (TFC_Core.isEastFaceSolid(world, x + map[0], y, z + map[1])
              && TFC_Core.isNorthFaceSolid(world, x + map[0], y, z + map[1])) r = true;
          break;
        case 2:
          if (TFC_Core.isSouthFaceSolid(world, x + map[0], y, z + map[1])
              && TFC_Core.isWestFaceSolid(world, x + map[0], y, z + map[1])) r = true;
          break;
        case 3:
          if (TFC_Core.isWestFaceSolid(world, x + map[0], y, z + map[1])
              && TFC_Core.isNorthFaceSolid(world, x + map[0], y, z + map[1])) r = true;
          break;
      }
    }

    if (!TFC_Core.isBottomFaceSolid(world, x + map[0], y, z + map[1])) r = false;
    if (!TFC_Core.isTopFaceSolid(world, x + map[0], y, z + map[1])) r = false;

    if (l && r) return true;

    return false;
  }