cn.nukkit.level.generator.object.ore.OreType Java Examples

The following examples show how to use cn.nukkit.level.generator.object.ore.OreType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Flat.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public Flat(Map<String, Object> options) {
    this.preset = "2;7,2x3,2;1;";
    this.options = options;

    if (this.options.containsKey("decoration")) {
        PopulatorOre ores = new PopulatorOre();
        ores.setOreTypes(new OreType[]{
                new OreType(new BlockOreCoal(), 20, 16, 0, 128),
                new OreType(new BlockOreIron(), 20, 8, 0, 64),
                new OreType(new BlockOreRedstone(), 8, 7, 0, 16),
                new OreType(new BlockOreLapis(), 1, 6, 0, 32),
                new OreType(new BlockOreGold(), 2, 8, 0, 32),
                new OreType(new BlockOreDiamond(), 1, 7, 0, 16),
                new OreType(new BlockDirt(), 20, 32, 0, 128),
                new OreType(new BlockGravel(), 20, 16, 0, 128),
        });
        this.populators.add(ores);
    }
}
 
Example #2
Source File: Flat.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public Flat(Map<String, Object> options) {
    this.preset = "2;7,2x3,2;1;";
    this.options = options;

    if (this.options.containsKey("decoration")) {
        PopulatorOre ores = new PopulatorOre();
        ores.setOreTypes(new OreType[]{
                new OreType(Block.get(BlockID.COAL_ORE), 20, 16, 0, 128),
                new OreType(Block.get(BlockID.IRON_ORE), 20, 8, 0, 64),
                new OreType(Block.get(BlockID.REDSTONE_ORE), 8, 7, 0, 16),
                new OreType(Block.get(BlockID.LAPIS_ORE), 1, 6, 0, 32),
                new OreType(Block.get(BlockID.GOLD_ORE), 2, 8, 0, 32),
                new OreType(Block.get(BlockID.DIAMOND_ORE), 1, 7, 0, 16),
                new OreType(Block.get(BlockID.DIRT), 20, 32, 0, 128),
                new OreType(Block.get(BlockID.GRAVEL), 20, 16, 0, 128),
        });
        this.populators.add(ores);
    }
}
 
Example #3
Source File: PopulatorOre.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random, FullChunk chunk) {
    int sx = chunkX << 4;
    int ex = sx + 15;
    int sz = chunkZ << 4;
    int ez = sz + 15;
    for (OreType type : this.oreTypes) {
        for (int i = 0; i < type.clusterCount; i++) {
            int x = NukkitMath.randomRange(random, sx, ex);
            int z = NukkitMath.randomRange(random, sz, ez);
            int y = NukkitMath.randomRange(random, type.minHeight, type.maxHeight);
            if (level.getBlockIdAt(x, y, z) != replaceId) {
                continue;
            }
            type.spawn(level, random, replaceId, x, y, z);
        }
    }
}
 
Example #4
Source File: Flat.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public Flat(Map<String, Object> options) {
    this.preset = "2;7,2x3,2;1;";
    this.options = options;

    if (this.options.containsKey("decoration")) {
        PopulatorOre ores = new PopulatorOre();
        ores.setOreTypes(new OreType[]{
                new OreType(new BlockOreCoal(), 20, 16, 0, 128),
                new OreType(new BlockOreIron(), 20, 8, 0, 64),
                new OreType(new BlockOreRedstone(), 8, 7, 0, 16),
                new OreType(new BlockOreLapis(), 1, 6, 0, 32),
                new OreType(new BlockOreGold(), 2, 8, 0, 32),
                new OreType(new BlockOreDiamond(), 1, 7, 0, 16),
                new OreType(new BlockDirt(), 20, 32, 0, 128),
                new OreType(new BlockGravel(), 20, 16, 0, 128),
        });
        this.populators.add(ores);
    }
}
 
Example #5
Source File: Nether.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(ChunkManager level, NukkitRandom random) {
    this.level = level;
    this.nukkitRandom = random;
    this.random = new Random();
    this.nukkitRandom.setSeed(this.level.getSeed());
    this.noiseBase = new Simplex(this.nukkitRandom, 4, 1 / 4f, 1 / 64f);
    this.nukkitRandom.setSeed(this.level.getSeed());
    this.localSeed1 = this.random.nextLong();
    this.localSeed2 = this.random.nextLong();
    PopulatorOre ores = new PopulatorOre(Block.NETHERRACK);
    ores.setOreTypes(new OreType[]{
            new OreType(new BlockOreQuartz(), 20, 16, 0, 128),
            new OreType(new BlockSoulSand(), 5, 64, 0, 128),
            new OreType(new BlockGravel(), 5, 64, 0, 128),
            new OreType(new BlockLava(), 1, 16, 0, (int) this.waterHeight),
    });
    this.populators.add(ores);
    this.populators.add(new PopulatorGlowStone());
    PopulatorGroundFire groundFire = new PopulatorGroundFire();
    groundFire.setBaseAmount(1);
    groundFire.setRandomAmount(1);
    this.populators.add(groundFire);
    PopulatorLava lava = new PopulatorLava();
    lava.setBaseAmount(0);
    lava.setRandomAmount(2);
    this.populators.add(lava);
}
 
Example #6
Source File: PopulatorOre.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    for (OreType type : this.oreTypes) {
        ObjectOre ore = new ObjectOre(random, type, replaceId);
        for (int i = 0; i < ore.type.clusterCount; ++i) {
            int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
            int y = NukkitMath.randomRange(random, ore.type.minHeight, ore.type.maxHeight);
            int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
            if (ore.canPlaceObject(level, x, y, z)) {
                ore.placeObject(level, x, y, z);
            }
        }
    }
}
 
Example #7
Source File: Nether.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(ChunkManager level, NukkitRandom random) {
    this.level = level;
    this.nukkitRandom = random;
    this.random = new Random();
    this.nukkitRandom.setSeed(this.level.getSeed());
    this.noiseBase = new Simplex(this.nukkitRandom, 4, 1 / 4f, 1 / 64f);
    this.nukkitRandom.setSeed(this.level.getSeed());
    this.localSeed1 = this.random.nextLong();
    this.localSeed2 = this.random.nextLong();
    PopulatorOre ores = new PopulatorOre(Block.NETHERRACK);
    ores.setOreTypes(new OreType[]{
            new OreType(new BlockOreQuartz(), 20, 16, 0, 128),
            new OreType(new BlockSoulSand(), 5, 64, 0, 128),
            new OreType(new BlockGravel(), 5, 64, 0, 128),
            new OreType(new BlockLava(), 1, 16, 0, (int) this.waterHeight),
    });
    this.populators.add(ores);
    this.populators.add(new PopulatorGlowStone());
    PopulatorGroundFire groundFire = new PopulatorGroundFire();
    groundFire.setBaseAmount(1);
    groundFire.setRandomAmount(1);
    this.populators.add(groundFire);
    PopulatorLava lava = new PopulatorLava();
    lava.setBaseAmount(0);
    lava.setRandomAmount(2);
    this.populators.add(lava);
}
 
Example #8
Source File: PopulatorOre.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    for (OreType type : this.oreTypes) {
        ObjectOre ore = new ObjectOre(random, type, replaceId);
        for (int i = 0; i < ore.type.clusterCount; ++i) {
            int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
            int y = NukkitMath.randomRange(random, ore.type.minHeight, ore.type.maxHeight);
            int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
            if (ore.canPlaceObject(level, x, y, z)) {
                ore.placeObject(level, x, y, z);
            }
        }
    }
}
 
Example #9
Source File: Normal.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void init(ChunkManager level, NukkitRandom random) {
        this.level = level;
        this.nukkitRandom = random;
        this.random = new Random();
        this.nukkitRandom.setSeed(this.level.getSeed());
        this.localSeed1 = this.random.nextLong();
        this.localSeed2 = this.random.nextLong();
        this.noiseSeaFloor = new Simplex(this.nukkitRandom, 1F, 1F / 8F, 1F / 64F);
        this.noiseLand = new Simplex(this.nukkitRandom, 2F, 1F / 8F, 1F / 512F);
        this.noiseMountains = new Simplex(this.nukkitRandom, 4F, 1F, 1F / 500F);
        this.noiseBaseGround = new Simplex(this.nukkitRandom, 4F, 1F / 4F, 1F / 64F);
        this.noiseRiver = new Simplex(this.nukkitRandom, 2F, 1F, 1F / 512F);
        this.nukkitRandom.setSeed(this.level.getSeed());
        this.selector = new BiomeSelector(this.nukkitRandom, Biome.getBiome(Biome.FOREST));
        this.heightOffset = random.nextRange(-5, 3);

        this.selector.addBiome(Biome.getBiome(OCEAN));
        this.selector.addBiome(Biome.getBiome(PLAINS));
        this.selector.addBiome(Biome.getBiome(DESERT));
        this.selector.addBiome(Biome.getBiome(FOREST));
        this.selector.addBiome(Biome.getBiome(TAIGA));
        this.selector.addBiome(Biome.getBiome(RIVER));
        this.selector.addBiome(Biome.getBiome(ICE_PLAINS));
        this.selector.addBiome(Biome.getBiome(BIRCH_FOREST));

        this.selector.addBiome(Biome.getBiome(JUNGLE));
        this.selector.addBiome(Biome.getBiome(SAVANNA));
        this.selector.addBiome(Biome.getBiome(ROOFED_FOREST));
        this.selector.addBiome(Biome.getBiome(ROOFED_FOREST_M));
        this.selector.addBiome(Biome.getBiome(MUSHROOM_ISLAND));
        this.selector.addBiome(Biome.getBiome(SWAMP));

        this.selector.recalculate();


        PopulatorCaves caves = new PopulatorCaves();
        this.populators.add(caves);

        PopulatorRavines ravines = new PopulatorRavines();
        this.populators.add(ravines);

//        PopulatorDungeon dungeons = new PopulatorDungeon();
//        this.populators.add(dungeons);

        PopulatorGroundCover cover = new PopulatorGroundCover();
        this.generationPopulators.add(cover);

        PopulatorOre ores = new PopulatorOre();
        ores.setOreTypes(new OreType[]{
                new OreType(new BlockOreCoal(), 20, 17, 0, 128),
                new OreType(new BlockOreIron(), 20, 9, 0, 64),
                new OreType(new BlockOreRedstone(), 8, 8, 0, 16),
                new OreType(new BlockOreLapis(), 1, 7, 0, 16),
                new OreType(new BlockOreGold(), 2, 9, 0, 32),
                new OreType(new BlockOreDiamond(), 1, 8, 0, 16),
                new OreType(new BlockDirt(), 10, 33, 0, 128),
                new OreType(new BlockGravel(), 8, 33, 0, 128),
                new OreType(new BlockStone(BlockStone.GRANITE), 10, 33, 0, 80),
                new OreType(new BlockStone(BlockStone.DIORITE), 10, 33, 0, 80),
                new OreType(new BlockStone(BlockStone.ANDESITE), 10, 33, 0, 80)
        });
        this.populators.add(ores);
    }
 
Example #10
Source File: PopulatorOre.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public void setOreTypes(OreType[] oreTypes) {
    this.oreTypes = oreTypes;
}
 
Example #11
Source File: Nether.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void init(ChunkManager level, NukkitRandom random) {
    this.level = level;
    this.nukkitRandom = random;
    this.random = new Random();
    this.nukkitRandom.setSeed(this.level.getSeed());

    for (int i = 0; i < noiseGen.length; i++)   {
        noiseGen[i] = new SimplexF(nukkitRandom, 4, 1 / 4f, 1 / 64f);
    }

    this.nukkitRandom.setSeed(this.level.getSeed());
    this.localSeed1 = this.random.nextLong();
    this.localSeed2 = this.random.nextLong();

    PopulatorOre ores = new PopulatorOre(Block.NETHERRACK);
    ores.setOreTypes(new OreType[]{
            new OreType(Block.get(BlockID.QUARTZ_ORE), 20, 16, 0, 128),
            new OreType(Block.get(BlockID.SOUL_SAND), 5, 64, 0, 128),
            new OreType(Block.get(BlockID.GRAVEL), 5, 64, 0, 128),
            new OreType(Block.get(BlockID.LAVA), 1, 16, 0, (int) this.lavaHeight),
    });
    this.populators.add(ores);

    PopulatorGroundFire groundFire = new PopulatorGroundFire();
    groundFire.setBaseAmount(1);
    groundFire.setRandomAmount(1);
    this.populators.add(groundFire);

    PopulatorLava lava = new PopulatorLava();
    lava.setBaseAmount(1);
    lava.setRandomAmount(2);
    this.populators.add(lava);
    this.populators.add(new PopulatorGlowStone());
    PopulatorOre ore = new PopulatorOre(Block.NETHERRACK);
    ore.setOreTypes(new OreType[]{
            new OreType(Block.get(BlockID.QUARTZ_ORE), 40, 16, 0, 128, NETHERRACK),
            new OreType(Block.get(BlockID.SOUL_SAND), 1, 64, 30, 35, NETHERRACK),
            new OreType(Block.get(BlockID.LAVA), 32, 1, 0, 32, NETHERRACK),
            new OreType(Block.get(BlockID.MAGMA), 32, 16, 26, 37, NETHERRACK),
    });
    this.populators.add(ore);
}
 
Example #12
Source File: Normal.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void init(ChunkManager level, NukkitRandom random) {
    this.level = level;
    this.nukkitRandom = random;
    this.random = new Random();
    this.nukkitRandom.setSeed(this.level.getSeed());
    this.localSeed1 = this.random.nextLong();
    this.localSeed2 = this.random.nextLong();
    this.nukkitRandom.setSeed(this.level.getSeed());
    this.selector = new BiomeSelector(this.nukkitRandom);

    this.minLimitPerlinNoise = new NoiseGeneratorOctavesF(random, 16);
    this.maxLimitPerlinNoise = new NoiseGeneratorOctavesF(random, 16);
    this.mainPerlinNoise = new NoiseGeneratorOctavesF(random, 8);
    this.surfaceNoise = new NoiseGeneratorPerlinF(random, 4);
    this.scaleNoise = new NoiseGeneratorOctavesF(random, 10);
    this.depthNoise = new NoiseGeneratorOctavesF(random, 16);

    //this should run before all other populators so that we don't do things like generate ground cover on bedrock or something
    PopulatorGroundCover cover = new PopulatorGroundCover();
    this.generationPopulators.add(cover);

    PopulatorBedrock bedrock = new PopulatorBedrock();
    this.generationPopulators.add(bedrock);

    PopulatorOre ores = new PopulatorOre();
    ores.setOreTypes(new OreType[]{
            new OreType(Block.get(BlockID.COAL_ORE), 20, 17, 0, 128),
            new OreType(Block.get(BlockID.IRON_ORE), 20, 9, 0, 64),
            new OreType(Block.get(BlockID.REDSTONE_ORE), 8, 8, 0, 16),
            new OreType(Block.get(BlockID.LAPIS_ORE), 1, 7, 0, 16),
            new OreType(Block.get(BlockID.GOLD_ORE), 2, 9, 0, 32),
            new OreType(Block.get(BlockID.DIAMOND_ORE), 1, 8, 0, 16),
            new OreType(Block.get(BlockID.DIRT), 10, 33, 0, 128),
            new OreType(Block.get(BlockID.GRAVEL), 8, 33, 0, 128),
            new OreType(Block.get(BlockID.STONE, BlockStone.GRANITE), 10, 33, 0, 80),
            new OreType(Block.get(BlockID.STONE, BlockStone.DIORITE), 10, 33, 0, 80),
            new OreType(Block.get(BlockID.STONE, BlockStone.ANDESITE), 10, 33, 0, 80)
    });
    this.populators.add(ores);

    PopulatorCaves caves = new PopulatorCaves();
    this.populators.add(caves);

    //TODO: fix ravines
    //PopulatorRavines ravines = new PopulatorRavines();
    //this.populators.add(ravines);
}
 
Example #13
Source File: PopulatorOre.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public void setOreTypes(OreType[] oreTypes) {
    this.oreTypes = oreTypes;
}
 
Example #14
Source File: Normal.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void init(ChunkManager level, NukkitRandom random) {
        this.level = level;
        this.nukkitRandom = random;
        this.random = new Random();
        this.nukkitRandom.setSeed(this.level.getSeed());
        this.localSeed1 = this.random.nextLong();
        this.localSeed2 = this.random.nextLong();
        this.noiseSeaFloor = new Simplex(this.nukkitRandom, 1F, 1F / 8F, 1F / 64F);
        this.noiseLand = new Simplex(this.nukkitRandom, 2F, 1F / 8F, 1F / 512F);
        this.noiseMountains = new Simplex(this.nukkitRandom, 4F, 1F, 1F / 500F);
        this.noiseBaseGround = new Simplex(this.nukkitRandom, 4F, 1F / 4F, 1F / 64F);
        this.noiseRiver = new Simplex(this.nukkitRandom, 2F, 1F, 1F / 512F);
        this.nukkitRandom.setSeed(this.level.getSeed());
        this.selector = new BiomeSelector(this.nukkitRandom, Biome.getBiome(Biome.FOREST));
        this.heightOffset = random.nextRange(-5, 3);

        this.selector.addBiome(Biome.getBiome(OCEAN));
        this.selector.addBiome(Biome.getBiome(PLAINS));
        this.selector.addBiome(Biome.getBiome(DESERT));
        this.selector.addBiome(Biome.getBiome(FOREST));
        this.selector.addBiome(Biome.getBiome(TAIGA));
        this.selector.addBiome(Biome.getBiome(RIVER));
        this.selector.addBiome(Biome.getBiome(ICE_PLAINS));
        this.selector.addBiome(Biome.getBiome(BIRCH_FOREST));

        this.selector.addBiome(Biome.getBiome(JUNGLE));
        this.selector.addBiome(Biome.getBiome(SAVANNA));
        this.selector.addBiome(Biome.getBiome(ROOFED_FOREST));
        this.selector.addBiome(Biome.getBiome(ROOFED_FOREST_M));
        this.selector.addBiome(Biome.getBiome(MUSHROOM_ISLAND));
        this.selector.addBiome(Biome.getBiome(SWAMP));

        this.selector.recalculate();


        PopulatorCaves caves = new PopulatorCaves();
        this.populators.add(caves);

        PopulatorRavines ravines = new PopulatorRavines();
        this.populators.add(ravines);

//        PopulatorDungeon dungeons = new PopulatorDungeon();
//        this.populators.add(dungeons);

        PopulatorGroundCover cover = new PopulatorGroundCover();
        this.generationPopulators.add(cover);

        PopulatorOre ores = new PopulatorOre();
        ores.setOreTypes(new OreType[]{
                new OreType(new BlockOreCoal(), 20, 17, 0, 128),
                new OreType(new BlockOreIron(), 20, 9, 0, 64),
                new OreType(new BlockOreRedstone(), 8, 8, 0, 16),
                new OreType(new BlockOreLapis(), 1, 7, 0, 16),
                new OreType(new BlockOreGold(), 2, 9, 0, 32),
                new OreType(new BlockOreDiamond(), 1, 8, 0, 16),
                new OreType(new BlockDirt(), 10, 33, 0, 128),
                new OreType(new BlockGravel(), 8, 33, 0, 128),
                new OreType(new BlockStone(BlockStone.GRANITE), 10, 33, 0, 80),
                new OreType(new BlockStone(BlockStone.DIORITE), 10, 33, 0, 80),
                new OreType(new BlockStone(BlockStone.ANDESITE), 10, 33, 0, 80)
        });
        this.populators.add(ores);
    }
 
Example #15
Source File: PopulatorOre.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public void setOreTypes(OreType[] oreTypes) {
    this.oreTypes = oreTypes;
}