• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SimplexOctaveGenerator类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.bukkit.util.noise.SimplexOctaveGenerator的典型用法代码示例。如果您正苦于以下问题:Java SimplexOctaveGenerator类的具体用法?Java SimplexOctaveGenerator怎么用?Java SimplexOctaveGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SimplexOctaveGenerator类属于org.bukkit.util.noise包,在下文中一共展示了SimplexOctaveGenerator类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: populate

点赞 3

import org.bukkit.util.noise.SimplexOctaveGenerator; //导入依赖的package包/类
@Override
public void populate(World world, Random random, Chunk source) {
	int worldChunkX = source.getX() * 16;
	int worldChunkZ = source.getZ() * 16;
	int x, y, z;
	SimplexOctaveGenerator noiseGenerator = new SimplexOctaveGenerator(world, 8);
	noiseGenerator.setScale(1 / 32.0);
	for (x = worldChunkX; x < worldChunkX + 16; x++) {
		for (z = worldChunkZ; z < worldChunkZ + 16; z++) {
			for (y = world.getMaxHeight() - caveCentre; y > world.getMaxHeight() - (caveCentre + (noiseGenerator.noise(x, z, 0.5, 0.5) * (maxCaveHeight / 2))); y--) {
				if (world.getBlockAt(x, y, z).getType() != Material.AIR) {
					world.getBlockAt(x, y, z).setType(Material.AIR);
				}
			}
			for (y = world.getMaxHeight() - caveCentre; y < world.getMaxHeight() - (caveCentre - (noiseGenerator.noise(x, z, 0.5, 0.5) * (maxCaveHeight / 2))); y++) {
				if (world.getBlockAt(x, y, z).getType() != Material.AIR) {
					world.getBlockAt(x, y, z).setType(Material.AIR);
				}
			}
		}
	}
}
 

开发者ID:alyphen,
项目名称:BukkitPopulators,
代码行数:23,
代码来源:CavePopulator.java

示例2: populate

点赞 3

import org.bukkit.util.noise.SimplexOctaveGenerator; //导入依赖的package包/类
public void populate(World world, Random rand, Chunk chunk){
	int chunkX = chunk.getX();
	int chunkZ = chunk.getZ();
	
	SimplexOctaveGenerator soulSandNoise = new SimplexOctaveGenerator(world, 8);
	soulSandNoise.setScale(1 / 32.0);
	
	for (int x = 0; x < 16; ++x){
		for (int z = 0; z < 16; ++z){
			int blockX = x + chunkX * 16;
			int blockZ = z + chunkZ * 16;
			
			if (soulSandNoise.noise(blockX, blockZ, 0.5, 0.5) > 0.25D){
				for (int y = 128; y > 0; --y){
					Block block = world.getBlockAt(blockX, y, blockZ);
					
					if (block.getType() == Material.NETHERRACK && block.getRelative(BlockFace.UP).getType() == Material.AIR){
						block.setType(Material.SOUL_SAND);
					}
				}
			}
		}
	}
}
 

开发者ID:alyphen,
项目名称:BukkitPopulators,
代码行数:25,
代码来源:NetherSoulSandPopulator.java

示例3: generate

点赞 2

import org.bukkit.util.noise.SimplexOctaveGenerator; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public byte[] generate(World world, Random random, int chunkX, int chunkZ) {
	byte[] b = new byte[16*16*128];
	Random seed = new Random(world.getSeed());
	SimplexOctaveGenerator gen =  new SimplexOctaveGenerator(seed, 8);
	gen.setScale(1/40.0);

	for (int x=0; x<16; x++){
		for (int z=0; z<16; z++){
			int multiplier = 5;
			double noise = gen.noise(x+chunkX*16, z+chunkZ*16, 0.5, 0.5)*multiplier;
			for(int y=0; y<32+noise; y++){
				if(b[xyzToByte(x,y,z)] ==0)
					if(y == 0)
						b[xyzToByte(x,y,z)] = (byte)  (Material.BEDROCK).getId();
					else
						b[xyzToByte(x,y,z)] = (byte)  (Material.SNOW_BLOCK).getId();
			}
			for(int y=0; y<20; y++)
			{
				if(b[xyzToByte(x,y,z)] == 0)
					b[xyzToByte(x,y,z)] = (byte)  (Material.STATIONARY_WATER).getId();
			}

			b[xyzToByte(x,0,z)] = (byte)  (Material.BEDROCK).getId();
		}
	}

	return b;
}
 

开发者ID:EmilHernvall,
项目名称:tregmine,
代码行数:31,
代码来源:ChristmasChunkGenerator.java

示例4: populate

点赞 2

import org.bukkit.util.noise.SimplexOctaveGenerator; //导入依赖的package包/类
@Override
public void populate(World world, Random random, Chunk source) {
    int worldChunkX = source.getX() * 16;
    int worldChunkZ = source.getZ() * 16;
    int x, y, z;
    SimplexOctaveGenerator noiseGenerator = new SimplexOctaveGenerator(world, 8);
    noiseGenerator.setScale(1 / 32.0);
    for (x = worldChunkX; x < worldChunkX + 16; x++) {
        for (z = worldChunkZ; z < worldChunkZ + 16; z++) {
            for (y = world.getMaxHeight() - caveCentre; y > world.getMaxHeight() - (caveCentre + (noiseGenerator.noise(x, z, 0.5, 0.5) * (maxCaveHeight / 2))); y--) {
                if (world.getBlockAt(x, y, z).getType() != Material.AIR) {
                    world.getBlockAt(x, y, z).setType(source.getX() % 4 == 0 && source.getZ() % 4 == 0 && (x - worldChunkX == 12 || x - worldChunkX == 15) && (z - worldChunkZ == 12 || z - worldChunkZ == 15) ? Material.LOG : Material.AIR);
                }
            }
            for (y = world.getMaxHeight() - caveCentre; y < world.getMaxHeight() - (caveCentre - (noiseGenerator.noise(x, z, 0.5, 0.5) * (maxCaveHeight / 2))); y++) {
                if (world.getBlockAt(x, y, z).getType() != Material.AIR) {
                    world.getBlockAt(x, y, z).setType(source.getX() % 4 == 0 && source.getZ() % 4 == 0 && (x - worldChunkX == 12 || x - worldChunkX == 15) && (z - worldChunkZ == 12 || z - worldChunkZ == 15) && y < 144 ? Material.LOG : Material.AIR);
                }
            }
        }
    }
    if (source.getX() % 4 == 0) {
        y = 144;
        for (x = worldChunkX + 12; x < worldChunkX + 16; x++) {
            for (z = worldChunkZ; z < worldChunkZ + 16; z++) {
                if (world.getBlockAt(x, y, z).getType() == Material.AIR) {
                    world.getBlockAt(x, y, z).setType(Material.WOOD);
                }
            }
        }
    }
    if (source.getZ() % 4 == 0) {
        y = 112;
        for (x = worldChunkX; x < worldChunkX + 16; x++) {
            for (z = worldChunkZ + 12; z < worldChunkZ + 16; z++) {
                if (world.getBlockAt(x, y, z).getType() == Material.AIR) {
                    world.getBlockAt(x, y, z).setType(Material.WOOD);
                }
            }
        }
    }
}
 

开发者ID:WaywardRealms,
项目名称:Wayward,
代码行数:43,
代码来源:CavePopulator.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)