Search in sources :

Example 1 with OreSpawnBlockMatcher

use of com.mcmoddev.orespawn.api.os3.OreSpawnBlockMatcher in project OreSpawn by MinecraftModDevelopmentMods.

the class FeatureBase method spawnMungeSW.

protected void spawnMungeSW(World world, BlockPos blockPos, int rSqr, double radius, ISpawnEntry spawnData, int count) {
    Random prng = this.random;
    int quantity = count;
    IBlockList possibleOres = spawnData.getBlocks();
    OreSpawnBlockMatcher replacer = spawnData.getMatcher();
    for (int dy = (int) (-1 * radius); dy < radius; dy++) {
        for (int dx = (int) (radius); dx >= (int) (-1 * radius); dx--) {
            for (int dz = (int) (radius); dz >= (int) (-1 * radius); dz--) {
                if ((dx * dx + dy * dy + dz * dz) <= rSqr) {
                    IBlockState oreBlock = possibleOres.getRandomBlock(prng);
                    spawnOrCache(world, blockPos.add(dx, dy, dz), replacer, oreBlock, true, world.provider.getDimension(), spawnData);
                    quantity--;
                }
                if (quantity <= 0) {
                    return;
                }
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) OreSpawnBlockMatcher(com.mcmoddev.orespawn.api.os3.OreSpawnBlockMatcher)

Example 2 with OreSpawnBlockMatcher

use of com.mcmoddev.orespawn.api.os3.OreSpawnBlockMatcher in project OreSpawn by MinecraftModDevelopmentMods.

the class FeatureBase method spawnMungeNE.

protected void spawnMungeNE(World world, BlockPos blockPos, int rSqr, double radius, ISpawnEntry spawnData, int count) {
    Random prng = this.random;
    int quantity = count;
    IBlockList possibleOres = spawnData.getBlocks();
    OreSpawnBlockMatcher replacer = spawnData.getMatcher();
    for (int dy = (int) (-1 * radius); dy < radius; dy++) {
        for (int dz = (int) (-1 * radius); dz < radius; dz++) {
            for (int dx = (int) (-1 * radius); dx < radius; dx++) {
                if ((dx * dx + dy * dy + dz * dz) <= rSqr) {
                    IBlockState oreBlock = possibleOres.getRandomBlock(prng);
                    spawnOrCache(world, blockPos.add(dx, dy, dz), replacer, oreBlock, true, world.provider.getDimension(), spawnData);
                    quantity--;
                }
                if (quantity <= 0) {
                    return;
                }
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) OreSpawnBlockMatcher(com.mcmoddev.orespawn.api.os3.OreSpawnBlockMatcher)

Aggregations

OreSpawnBlockMatcher (com.mcmoddev.orespawn.api.os3.OreSpawnBlockMatcher)2 IBlockState (net.minecraft.block.state.IBlockState)2