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);
}
});
}
}
}
Aggregations