Exemplo n.º 1
0
  public static void initStateMaps(MazeTower tower) {
    if (rawMaps != null && rawMaps.containsKey(tower.wallBlock_external)) {
      final EnumDyeColor[] dyeColors = tower.getDyeColors();
      final IBlockState air2 = Blocks.AIR.getDefaultState();
      final IBlockState wall = tower.wallBlock_external;
      final IBlockState wall2 = tower.wallBlock;
      final IBlockState c = tower.floorBlock;
      final IBlockState window = Blocks.GLASS_PANE.getDefaultState();
      final IBlockState[] carpet =
          new IBlockState[] {
            tower.getColourBlockState(Blocks.CARPET, dyeColors[0]),
            tower.getColourBlockState(Blocks.CARPET, dyeColors[1]),
            tower.getColourBlockState(Blocks.CARPET, dyeColors[2])
          };
      final IBlockState[] g =
          new IBlockState[] {
            tower.getColourBlockState(Blocks.STAINED_GLASS, dyeColors[0]),
            tower.getColourBlockState(Blocks.STAINED_GLASS, dyeColors[1]),
            tower.getColourBlockState(Blocks.STAINED_GLASS, dyeColors[2])
          };
      final IBlockState lamp = Blocks.REDSTONE_LAMP.getDefaultState();
      final IBlockState wire = Blocks.REDSTONE_WIRE.getDefaultState();

      for (EnumFacing dir : dirs) {
        maps.get(tower.wallBlock_external)[EnumStateMap.MINI_TOWER_CEILING_1.ordinal()].put(
            dir, getCeiling(air2, wall, wall2, c, g[0], lamp));
        maps.get(tower.wallBlock_external)[EnumStateMap.MINI_TOWER_CEILING_2.ordinal()].put(
            dir, getCeiling(air2, wall, wall2, c, g[1], lamp));
        maps.get(tower.wallBlock_external)[EnumStateMap.MINI_TOWER_CEILING_3.ordinal()].put(
            dir, getCeiling(air2, wall, wall2, c, g[2], lamp));
      }
    } else {
      final IBlockState[][][][] towerRawMaps;
      final Map<EnumFacing, IBlockState[][][]>[] towerMaps;

      if (rawMaps == null) {
        rawMaps = new HashMap<IBlockState, IBlockState[][][][]>();
        maps = new HashMap<IBlockState, Map<EnumFacing, IBlockState[][][]>[]>();
      }
      towerRawMaps = getRawMapsForTower(tower);
      rawMaps.put(tower.wallBlock_external, towerRawMaps);
      towerMaps = new Map[EnumStateMap.values().length];

      for (EnumStateMap map : EnumStateMap.values()) {
        final int mapIndex = map.ordinal();
        towerMaps[mapIndex] = new HashMap<EnumFacing, IBlockState[][][]>();
        for (EnumFacing dir : dirs) {
          final EnumFacing checkDir = EnumFacing.NORTH;
          if (dir == EnumFacing.SOUTH) towerMaps[mapIndex].put(dir, towerRawMaps[mapIndex]);
          else {
            if (mapIndex != 1)
              towerMaps[mapIndex].put(
                  dir, MTHelper.getRotatedStateMap(towerRawMaps[mapIndex], checkDir, dir, true));
            else
              towerMaps[mapIndex].put(
                  dir,
                  MTHelper.getRotatedStateMap(
                      MTHelper.getStairRotatedStairsMap(
                          towerRawMaps[mapIndex], EnumFacing.SOUTH, dir, tower.stairsBlock, torch),
                      checkDir,
                      dir,
                      true));
          }
        }
      }

      maps.put(tower.wallBlock_external, towerMaps);
    }
  }