Search in sources :

Example 1 with GlowDungeon

use of net.glowstone.generator.structures.GlowDungeon in project Glowstone by GlowstoneMC.

the class DungeonPopulator method populate.

@Override
public void populate(World world, Random random, Chunk source) {
    SimplexNoiseGenerator noise = new SimplexNoiseGenerator(world);
    double density = noise.noise(source.getX(), source.getZ());
    if (density > 0.8) {
        // TODO later switch to this loop to have 8 attempts of dungeon placement per chunk, once we get caves and ravines
        //for (int i = 0; i < 8; i++) {
        int x = (source.getX() << 4) + random.nextInt(16);
        int z = (source.getZ() << 4) + random.nextInt(16);
        int y = random.nextInt(256);
        GlowDungeon dungeon = new GlowDungeon(random, new Location(world, x, y, z));
        BlockStateDelegate delegate = new BlockStateDelegate();
        if (dungeon.generate(world, random, new StructureBoundingBox(new Vector(x - 15, 1, z - 15), new Vector(x + 15, 511, z + 15)), delegate)) {
            delegate.updateBlockStates();
        }
    //}
    }
}
Also used : BlockStateDelegate(net.glowstone.util.BlockStateDelegate) GlowDungeon(net.glowstone.generator.structures.GlowDungeon) StructureBoundingBox(net.glowstone.generator.structures.util.StructureBoundingBox) SimplexNoiseGenerator(org.bukkit.util.noise.SimplexNoiseGenerator) Vector(org.bukkit.util.Vector) Location(org.bukkit.Location)

Aggregations

GlowDungeon (net.glowstone.generator.structures.GlowDungeon)1 StructureBoundingBox (net.glowstone.generator.structures.util.StructureBoundingBox)1 BlockStateDelegate (net.glowstone.util.BlockStateDelegate)1 Location (org.bukkit.Location)1 Vector (org.bukkit.util.Vector)1 SimplexNoiseGenerator (org.bukkit.util.noise.SimplexNoiseGenerator)1