Ejemplo n.º 1
0
 public void addBlocks() {
   dusts.addAll(oresToBlocks(OreDictionary.getOres("oreSaltpeter")));
   if (!OreDictionary.getOres("oreSulfur").isEmpty())
     dusts.addAll(oresToBlocks(OreDictionary.getOres("oreSulfur")));
   dusts.addAll(oresToBlocks(OreDictionary.getOres("oreLapis")));
   dusts.addAll(oresToBlocks(OreDictionary.getOres("oreRedstone")));
   dusts.addAll(oresToBlocks(OreDictionary.getOres("oreCoal")));
   dusts.addAll(oresToBlocks(OreDictionary.getOres("oreCoralium")));
   metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreIron")));
   metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreGold")));
   metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreAbyssalnite")));
   metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreDreadedAbyssalnite")));
   metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreCopper")));
   metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreTin")));
   if (!OreDictionary.getOres("oreAluminum").isEmpty())
     metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreAluminum")));
   if (!OreDictionary.getOres("oreAluminium").isEmpty())
     metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreAluminium")));
   if (!OreDictionary.getOres("oreBrass").isEmpty())
     metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreBrass")));
   if (!OreDictionary.getOres("oreSilver").isEmpty())
     metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreSilver")));
   if (!OreDictionary.getOres("oreZinc").isEmpty())
     metalloids.addAll(oresToBlocks(OreDictionary.getOres("oreZinc")));
   gems.addAll(oresToBlocks(OreDictionary.getOres("oreDiamond")));
   gems.addAll(oresToBlocks(OreDictionary.getOres("oreEmerald")));
   gems.addAll(oresToBlocks(OreDictionary.getOres("oreQuartz")));
   if (!OreDictionary.getOres("oreSapphire").isEmpty())
     gems.addAll(oresToBlocks(OreDictionary.getOres("oreSapphire")));
   if (!OreDictionary.getOres("oreRuby").isEmpty())
     gems.addAll(oresToBlocks(OreDictionary.getOres("oreRuby")));
   gems.addAll(oresToBlocks(OreDictionary.getOres("oreCoraliumStone")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stone")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stoneGranite")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stoneGranitePolished")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stoneDiorite")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stoneDioritePolished")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stoneAndesite")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("stoneAndesitePolished")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("sandstone")));
   stones.addAll(oresToBlocks(OreDictionary.getOres("cobblestone")));
   stones.add(Blocks.MOSSY_COBBLESTONE.getDefaultState());
   stones.add(Blocks.NETHERRACK.getDefaultState());
   stones.add(Blocks.END_STONE.getDefaultState());
   stones.add(ACBlocks.darkstone.getDefaultState());
   stones.add(ACBlocks.abyssalnite_stone.getDefaultState());
   stones.add(ACBlocks.dreadstone.getDefaultState());
   stones.add(ACBlocks.darkstone_cobblestone.getDefaultState());
   bricks.add(Blocks.STONEBRICK.getStateFromMeta(0));
   bricks.add(Blocks.STONEBRICK.getStateFromMeta(1));
   bricks.add(Blocks.STONEBRICK.getStateFromMeta(2));
   bricks.add(Blocks.STONEBRICK.getStateFromMeta(3));
   bricks.add(Blocks.NETHER_BRICK.getDefaultState());
   bricks.add(ACBlocks.darkstone_brick.getDefaultState());
   bricks.add(ACBlocks.abyssalnite_stone_brick.getDefaultState());
   bricks.add(ACBlocks.dreadstone_brick.getDefaultState());
   metals.add(ACBlocks.abyssal_iron_ore.getDefaultState());
   metals.add(ACBlocks.abyssal_gold_ore.getDefaultState());
   metals.add(ACBlocks.abyssal_copper_ore.getDefaultState());
   metals.add(ACBlocks.abyssal_tin_ore.getDefaultState());
   metals.add(ACBlocks.liquified_coralium_ore.getDefaultState());
 }
Ejemplo n.º 2
0
  @Override
  public boolean generate(World world, Random rand, BlockPos pos) {
    int i1 = rand.nextInt(2) + 2;
    int j1 = -i1 - 1;
    int k1 = i1 + 1;
    int i2 = rand.nextInt(2) + 2;
    int j2 = -i2 - 1;
    int k2 = i2 + 1;
    int count = 0;

    for (int x = j1; x <= k1; ++x) {
      for (int y = -1; y <= 4; ++y) {
        for (int z = j2; z <= k2; ++z) {
          BlockPos blockpos = pos.add(x, y, z);
          Material material = world.getBlockState(blockpos).getMaterial();
          boolean flag = material.isSolid();

          if (y == -1 && !flag) {
            return false;
          }

          if (y == 4 && !flag) {
            return false;
          }

          if ((x == j1 || x == k1 || z == j2 || z == k2)
              && y == 0
              && world.isAirBlock(blockpos)
              && world.isAirBlock(blockpos.up())) {
            ++count;
          }
        }
      }
    }

    if (count >= 1 && count <= 5) {
      int type = rand.nextInt(2);
      IBlockState state1;
      IBlockState state2;

      switch (type) {
        case 1:
          state1 = Blocks.STONEBRICK.getDefaultState();
          state2 =
              Blocks.STONEBRICK
                  .getDefaultState()
                  .withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.MOSSY);
        default:
          state1 = Blocks.COBBLESTONE.getDefaultState();
          state2 = Blocks.MOSSY_COBBLESTONE.getDefaultState();
      }

      for (int x = j1; x <= k1; ++x) {
        for (int y = 3; y >= -1; --y) {
          for (int z = j2; z <= k2; ++z) {
            BlockPos blockpos = pos.add(x, y, z);

            if (x != j1 && y != -1 && z != j2 && x != k1 && y != 4 && z != k2) {
              if (world.getBlockState(blockpos).getBlock() != Blocks.CHEST) {
                world.setBlockToAir(blockpos);
              }
            } else if (blockpos.getY() >= 0
                && !world.getBlockState(blockpos.down()).getMaterial().isSolid()) {
              world.setBlockToAir(blockpos);
            } else if (world.getBlockState(blockpos).getMaterial().isSolid()
                && world.getBlockState(blockpos).getBlock() != Blocks.CHEST) {
              if (y == -1 && rand.nextInt(4) != 0) {
                world.setBlockState(blockpos, state2, 2);
              } else {
                world.setBlockState(blockpos, state1, 2);
              }
            }
          }
        }
      }

      for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 3; ++j) {
          int x = pos.getX() + rand.nextInt(i1 * 2 + 1) - i1;
          int y = pos.getY();
          int z = pos.getZ() + rand.nextInt(i2 * 2 + 1) - i2;
          BlockPos blockpos = new BlockPos(x, y, z);

          if (world.isAirBlock(blockpos)) {
            count = 0;

            for (EnumFacing face : EnumFacing.Plane.HORIZONTAL) {
              if (world.getBlockState(blockpos.offset(face)).getMaterial().isSolid()) {
                ++count;
              }
            }

            if (count == 1) {
              world.setBlockState(
                  blockpos,
                  Blocks.CHEST.correctFacing(world, blockpos, Blocks.CHEST.getDefaultState()),
                  2);

              TileEntity tile = world.getTileEntity(blockpos);

              if (tile != null && tile instanceof TileEntityChest) {
                ((TileEntityChest) tile)
                    .setLootTable(LootTableList.CHESTS_SIMPLE_DUNGEON, rand.nextLong());
              }

              break;
            }
          }
        }
      }

      world.setBlockState(pos, Blocks.MOB_SPAWNER.getDefaultState(), 2);

      TileEntity tile = world.getTileEntity(pos);

      if (tile != null && tile instanceof TileEntityMobSpawner) {
        ((TileEntityMobSpawner) tile).getSpawnerBaseLogic().setEntityName(pickMobSpawner(rand));
      } else {
        CaveLog.warning(
            "Failed to fetch mob spawner entity at ("
                + pos.getX()
                + ", "
                + pos.getY()
                + ", "
                + pos.getZ()
                + ")");
      }

      return true;
    }

    return false;
  }