Search in sources :

Example 1 with BlockOre

use of gregtech.common.blocks.BlockOre in project GregTech by GregTechCE.

the class GTWorldGenStone method generate.

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, Biome biome, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!this.isGenerationAllowed(world, biome) || this.probability <= 0)
        return;
    for (int i = 0; i < this.amount; i++) {
        if (random.nextInt(this.probability) == 0) {
            this.generate(random, chunkX, chunkZ, world, true, pos -> this.air || !world.isAirBlock(pos), (pos, r, rnd) -> {
                IBlockState blockState = world.getBlockState(pos);
                Block block = blockState.getBlock();
                if (this.stoneType != StoneTypes._NULL && block instanceof BlockOre) {
                    if (blockState.getValue(((BlockOre) block).STONE_TYPE) != this.stoneType) {
                        getOreBlock(((BlockOre) block).material, this.stoneType, blockState.getValue((BlockOre.SMALL))).ifPresent(ore -> world.setBlockState(pos, ore, 18));
                    }
                    return;
                }
                StoneType stoneType;
                if ((this.air && blockState.getBlock().isAir(blockState, world, pos)) || ((stoneType = StoneType.computeStoneType(blockState)) != StoneTypes._NULL && stoneType.harvestTool.equals("pickaxe"))) {
                    world.setBlockState(pos, this.stone);
                }
            });
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) StoneType(gregtech.api.unification.ore.StoneType) BlockOre(gregtech.common.blocks.BlockOre) Block(net.minecraft.block.Block)

Aggregations

StoneType (gregtech.api.unification.ore.StoneType)1 BlockOre (gregtech.common.blocks.BlockOre)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1