use of net.minecraft.world.gen.feature.WorldGenMinable in project BluePower by Qmunity.
the class WorldGenerationHandler method addOreToGenerate.
private void addOreToGenerate(Random random, int veinCount, int veinSize, int minY, int maxY, Block block, World world, int chunkX, int chunkZ) {
for (int i = 0; i < veinCount; i++) {
int x = chunkX * 16 + random.nextInt(16);
int y = random.nextInt(maxY - minY) + minY;
int z = chunkZ * 16 + random.nextInt(16);
new WorldGenMinable(block, veinSize).generate(world, random, x, y, z);
}
}
use of net.minecraft.world.gen.feature.WorldGenMinable in project RFToolsDimensions by McJty.
the class GenericWorldGenerator method addOreSpawn.
public void addOreSpawn(IBlockState block, IBlockState targetBlock, World world, Random random, int blockXPos, int blockZPos, int minVeinSize, int maxVeinSize, int chancesToSpawn, int minY, int maxY) {
WorldGenMinable minable = new WorldGenMinable(block, (minVeinSize - random.nextInt(maxVeinSize - minVeinSize)), p -> p == targetBlock);
for (int i = 0; i < chancesToSpawn; i++) {
int posX = blockXPos + random.nextInt(16);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(16);
minable.generate(world, random, new BlockPos(posX, posY, posZ));
}
}
use of net.minecraft.world.gen.feature.WorldGenMinable in project Pearcel-Mod by MiningMark48.
the class WorldGen method generateOre.
public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn) {
int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), veinSize, BlockMatcher.forBlock(generateIn));
for (int i = 0; i < chance; i++) {
int xRand = chunkX * 16 + random.nextInt(16);
int yRand = random.nextInt(heightRange) + minY;
int zRand = chunkZ * 16 + random.nextInt(16);
gen.generate(world, random, new BlockPos(xRand, yRand, zRand));
//LogHelper.info("Ore at " + xRand + " " + yRand + " " + zRand);
}
}
use of net.minecraft.world.gen.feature.WorldGenMinable in project Railcraft by Railcraft.
the class GeneratorMine method getGen.
@Nullable
private static WorldGenerator getGen(@Nullable IBlockState ore, int density) {
Predicate<IBlockState> genCheck = state -> RailcraftConfig.isWorldGenEnabled("sky") ? GenTools.AIR_STONE.test(state) : GenTools.STONE.test(state);
WorldGenerator gen;
if (ore == null)
gen = null;
else if (density >= 4)
gen = new WorldGenMinable(ore, density, genCheck::test);
else
gen = new WorldGenSmallDeposits(ore, density, genCheck);
return gen;
}
use of net.minecraft.world.gen.feature.WorldGenMinable in project Witchworks by Um-Mitternacht.
the class WorldGenOre method generateOre.
private void generateOre(World world, Random random, int chunkX, int chunkZ) {
final int heightRange = maxHeight - minHeight;
final int randFactor = (maxOreVeinSize - minOreVeinSize) > 0 ? random.nextInt(maxOreVeinSize - minOreVeinSize) : 0;
final int veinSize = minOreVeinSize + randFactor;
final WorldGenMinable generator = new WorldGenMinable(oreToGen, veinSize, predicate);
for (int i = 0; i < genChance; ++i) {
final int xRandom = chunkX * 16 + random.nextInt(16);
final int yRandom = random.nextInt(heightRange) + minHeight;
final int zRandom = chunkZ * 16 + random.nextInt(16);
generator.generate(world, random, new BlockPos(xRandom, yRandom, zRandom));
}
}
Aggregations