本文整理汇总了Java中org.bukkit.World.getSeed方法的典型用法代码示例。如果您正苦于以下问题:Java World.getSeed方法的具体用法?Java World.getSeed怎么用?Java World.getSeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.World
的用法示例。
在下文中一共展示了World.getSeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populate
import org.bukkit.World; //导入方法依赖的package包/类
@Override
public void populate(World world, Random random, Chunk chunk)
{
final int SPACING = 3;
final int FREQUENCY = 1;
final int chunkX = chunk.getX();
final int chunkZ = chunk.getZ();
// This way we can prevent two chunks from being next to each other.
//if(chunkX % SPACING != SPACING - 1 && chunkZ % SPACING != SPACING - 1)
//{
final int seedX = chunkX - (chunkX % SPACING);
final int seedZ = chunkZ - (chunkZ % SPACING);
long seed = world.getSeed();
seed *= LinearCongruentialGenerator.generate(world.getSeed());
seed += seedX;
seed *= LinearCongruentialGenerator.generate(world.getSeed());
seed += seedZ;
seed *= LinearCongruentialGenerator.generate(world.getSeed());
Random sectionRng = new Random(seed);
for(int i = 0; i < FREQUENCY; i++)
{
final int cX = seedX + sectionRng.nextInt(SPACING);
final int cZ = seedZ + sectionRng.nextInt(SPACING);
if(chunk.getX() == cX && chunk.getZ() == cZ)
{
System.out.println(chunkX + " " + chunkZ);
for(int x = 0; x < 16; x++)
{
for(int y = 0; y < 256; y++)
{
for(int z = 0; z < 16; z++)
{
chunk.getBlock(x, y, z).setType(Material.AIR);
}
}
}
}
}
//}
}