本文整理汇总了Java中cn.nukkit.level.generator.biome.Biome.getBiome方法的典型用法代码示例。如果您正苦于以下问题:Java Biome.getBiome方法的具体用法?Java Biome.getBiome怎么用?Java Biome.getBiome使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.level.generator.biome.Biome
的用法示例。
在下文中一共展示了Biome.getBiome方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateChunk
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void generateChunk(int chunkX, int chunkZ) {
this.nukkitRandom.setSeed(chunkX * localSeed1 ^ chunkZ * localSeed2 ^ this.level.getSeed());
double[][][] noise = Generator.getFastNoise3D(this.noiseBase, 16, 128, 16, 4, 8, 4, chunkX * 16, 0, chunkZ * 16);
FullChunk chunk = this.level.getChunk(chunkX, chunkZ);
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
Biome biome = Biome.getBiome(Biome.HELL);
chunk.setBiomeId(x, z, Biome.HELL);
int biomecolor = biome.getColor();
chunk.setBiomeColor(x, z, (biomecolor >> 16), (biomecolor >> 8) & 0xff, (biomecolor & 0xff));
chunk.setBlockId(x, 0, z, Block.BEDROCK);
chunk.setBlockId(x, 127, z, Block.BEDROCK);
for (int y = 1; y <= bedrockDepth; y++) {
if (nukkitRandom.nextRange(1, 5) == 1) {
chunk.setBlockId(x, y, z, Block.BEDROCK);
chunk.setBlockId(x, 127 - y, z, Block.BEDROCK);
}
}
for (int y = 1; y < 127; ++y) {
double noiseValue = (Math.abs(this.emptyHeight - y) / this.emptyHeight) * this.emptyAmplitude - noise[x][z][y];
noiseValue -= 1 - this.density;
if (noiseValue > 0) {
chunk.setBlockId(x, y, z, Block.NETHERRACK);
} else if (y <= this.waterHeight) {
chunk.setBlockId(x, y, z, Block.STILL_LAVA);
chunk.setBlockLight(x, y + 1, z, 15);
}
}
}
}
for (Populator populator : this.generationPopulators) {
populator.populate(this.level, chunkX, chunkZ, this.nukkitRandom);
}
}
示例2: populateChunk
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void populateChunk(int chunkX, int chunkZ) {
this.nukkitRandom.setSeed(0xdeadbeef ^ (chunkX << 8) ^ chunkZ ^ this.level.getSeed());
for (Populator populator : this.populators) {
populator.populate(this.level, chunkX, chunkZ, this.nukkitRandom);
}
FullChunk chunk = this.level.getChunk(chunkX, chunkZ);
Biome biome = Biome.getBiome(chunk.getBiomeId(7, 7));
biome.populateChunk(this.level, chunkX, chunkZ, this.nukkitRandom);
}
示例3: populate
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
FullChunk chunk = level.getChunk(chunkX, chunkZ);
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
Biome biome = Biome.getBiome(chunk.getBiomeId(x, z));
Block[] cover = biome.getGroundCover();
if (cover != null && cover.length > 0) {
int diffY = 0;
if (!cover[0].isSolid()) {
diffY = 1;
}
byte[] column = chunk.getBlockIdColumn(x, z);
int y;
for (y = 127; y > 0; --y) {
if (column[y] != 0x00 && !Block.get(column[y] & 0xff).isTransparent()) {
break;
}
}
int startY = Math.min(127, y + diffY);
int endY = startY - cover.length;
for (y = startY; y > endY && y >= 0; --y) {
Block b = cover[startY - y];
if (column[y] == 0x00 && b.isSolid()) {
break;
}
if (b.getDamage() == 0) {
chunk.setBlockId(x, y, z, b.getId());
} else {
chunk.setBlock(x, y, z, b.getId(), b.getDamage());
}
}
}
}
}
}
示例4: checkOldBiomes
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
protected void checkOldBiomes(byte[] data) {
if (data.length != 256) {
return;
}
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
Biome biome = Biome.getBiome(data[(z << 4) | x] & 0xff);
this.setBiomeId(x, z, biome.getId());
int c = biome.getColor();
this.setBiomeColor(x, z, c >> 16, (c >> 8) & 0xff, c & 0xff);
}
}
}
示例5: populateChunk
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void populateChunk(int chunkX, int chunkZ) {
this.random.setSeed(0xdeadbeef ^ (chunkX << 8) ^ chunkZ ^ this.level.getSeed());
for (Populator populator : this.populators) {
populator.populate(this.level, chunkX, chunkZ, this.random);
}
FullChunk chunk = this.level.getChunk(chunkX, chunkZ);
Biome biome = Biome.getBiome(chunk.getBiomeId(7, 7));
biome.populateChunk(this.level, chunkX, chunkZ, this.random);
}
示例6: checkOldBiomes
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
protected void checkOldBiomes(byte[] data) {
if (data.length != 256) {
return;
}
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
Biome biome = Biome.getBiome(data[(z << 4) + x] & 0xff);
this.setBiomeId(x, z, biome.getId());
int c = biome.getColor();
this.setBiomeColor(x, z, c >> 16, (c >> 8) & 0xff, c & 0xff);
}
}
}
示例7: init
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void init(ChunkManager level, NukkitRandom random) {
this.level = level;
this.random = random;
this.random.setSeed(this.level.getSeed());
this.noiseSeaFloor = new Simplex(this.random, 1F, 1F / 8F, 1F / 64F);
this.noiseLand = new Simplex(this.random, 2F, 1F / 8F, 1F / 512F);
this.noiseMountains = new Simplex(this.random, 4F, 1F, 1F / 500F);
this.noiseBaseGround = new Simplex(this.random, 4F, 1F / 4F, 1F / 64F);
this.noiseRiver = new Simplex(this.random, 2F, 1F, 1F / 512F);
this.random.setSeed(this.level.getSeed());
this.selector = new BiomeSelector(this.random, Biome.getBiome(Biome.OCEAN));
this.heightOffset = random.nextRange(-5, 3);
this.selector.addBiome(Biome.getBiome(Biome.OCEAN));
this.selector.addBiome(Biome.getBiome(Biome.PLAINS));
this.selector.addBiome(Biome.getBiome(Biome.DESERT));
this.selector.addBiome(Biome.getBiome(Biome.MOUNTAINS));
this.selector.addBiome(Biome.getBiome(Biome.FOREST));
this.selector.addBiome(Biome.getBiome(Biome.TAIGA));
this.selector.addBiome(Biome.getBiome(Biome.SWAMP));
this.selector.addBiome(Biome.getBiome(Biome.RIVER));
this.selector.addBiome(Biome.getBiome(Biome.ICE_PLAINS));
this.selector.addBiome(Biome.getBiome(Biome.SMALL_MOUNTAINS));
this.selector.addBiome(Biome.getBiome(Biome.BIRCH_FOREST));
this.selector.recalculate();
PopulatorGroundCover cover = new PopulatorGroundCover();
this.generationPopulators.add(cover);
PopulatorCaves caves = new PopulatorCaves();
this.populators.add(caves);
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(), 10, 16, 0, 128)
});
this.populators.add(ores);
}
示例8: setBiome
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public boolean setBiome(int x, int z, String biome) {
Biome b = Biome.getBiome(biome);
int id = b.getId();
Color color = new Color(b.getColor());
chunk.setBiomeId(x, z, id);
chunk.setBiomeColor(x, z, color.getRed(), color.getGreen(), color.getBlue());
return true;
}
示例9: fillBiome
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void fillBiome(String biome) {
Biome b = Biome.getBiome(biome);
int id = b.getId();
Color color = new Color(b.getColor());
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
chunk.setBiomeId(x, z, id);
chunk.setBiomeColor(x, z, color.getRed(), color.getGreen(), color.getBlue());
}
}
}
示例10: getBiomeFromString
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public int getBiomeFromString(String biomeString) {
try {
Biome biome = Biome.getBiome(biomeString.toUpperCase());
return biome.getId();
} catch (Throwable ignored) {
return -1;
}
}
示例11: init
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@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);
}
示例12: populate
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
initPopulate(random);
FullChunk chunk = level.getChunk(chunkX, chunkZ);
double[][][] cavesGenerate = Generator.getFastNoise3D(this.cavesSimplex, 16, 128, 16, 4, 4, 4, chunkX * 16, 0, chunkZ * 16);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
Biome biome = Biome.getBiome(chunk.getBiomeId(x, z));
Boolean hasWater = false;
Boolean heightestBlock = true;
if (biome instanceof WateryBiome) {
hasWater = true;
heightestBlock = false;
}
for (int y = 127; y >= 20; y--) {
if (chunk.getBlockId(x, y, z) == Block.AIR) {
continue;
}
if (chunk.getBlockId(x, y, z) == Block.WATER || chunk.getBlockId(x, y, z) == Block.STILL_WATER) {
hasWater = true;
heightestBlock = false;
continue;
}
if (hasWater) {
y -= 5;
hasWater = false;
continue;
}
if (cavesGenerate[x][z][y] > 0.35F) {
if (y > 20) {
chunk.setBlock(x, y, z, Block.AIR);
int highest = chunk.getHighestBlockAt(x, z);
/*int light = y < highest ? (highest - y < 10 ? highest - y : 1) : 10;
chunk.setBlockSkyLight(x, y, z, light);
int bl = 0;
if (y < 25) {
bl = (25 - y) * 2;
}
chunk.setBlockLight(x, y, z, bl);*/
} else {
//LAVA
chunk.setBlock(x, y, z, Block.LAVA);
/*chunk.setBlockSkyLight(x, y, z, 0);
chunk.setBlockLight(x, y, z, 15);*/
}
} else if (heightestBlock) {
if (chunk.getBlockId(x, y, z) == Block.DIRT) {
chunk.setBlock(x, y, z, Block.GRASS);
}
heightestBlock = false;
}
}
}
}
}
示例13: init
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@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.OCEAN));
this.heightOffset = random.nextRange(-5, 3);
this.selector.addBiome(Biome.getBiome(Biome.OCEAN));
this.selector.addBiome(Biome.getBiome(Biome.PLAINS));
this.selector.addBiome(Biome.getBiome(Biome.DESERT));
this.selector.addBiome(Biome.getBiome(Biome.MOUNTAINS));
this.selector.addBiome(Biome.getBiome(Biome.FOREST));
this.selector.addBiome(Biome.getBiome(Biome.TAIGA));
this.selector.addBiome(Biome.getBiome(Biome.SWAMP));
this.selector.addBiome(Biome.getBiome(Biome.RIVER));
this.selector.addBiome(Biome.getBiome(Biome.ICE_PLAINS));
this.selector.addBiome(Biome.getBiome(Biome.SMALL_MOUNTAINS));
this.selector.addBiome(Biome.getBiome(Biome.BIRCH_FOREST));
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, 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(), 10, 16, 0, 128)
});
this.populators.add(ores);
}
示例14: init
import cn.nukkit.level.generator.biome.Biome; //导入方法依赖的package包/类
@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(NormalGenerator.OCEAN));
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);
}