本文整理汇总了Java中cn.nukkit.math.NukkitRandom.nextBoundedInt方法的典型用法代码示例。如果您正苦于以下问题:Java NukkitRandom.nextBoundedInt方法的具体用法?Java NukkitRandom.nextBoundedInt怎么用?Java NukkitRandom.nextBoundedInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.math.NukkitRandom
的用法示例。
在下文中一共展示了NukkitRandom.nextBoundedInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: placeObject
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
public void placeObject(ChunkManager level, int x, int y, int z, NukkitRandom random) {
this.placeTrunk(level, x, y, z, random, this.getTreeHeight() - 1);
for (int yy = y - 3 + this.getTreeHeight(); yy <= y + this.getTreeHeight(); ++yy) {
double yOff = yy - (y + this.getTreeHeight());
int mid = (int) (1 - yOff / 2);
for (int xx = x - mid; xx <= x + mid; ++xx) {
int xOff = Math.abs(xx - x);
for (int zz = z - mid; zz <= z + mid; ++zz) {
int zOff = Math.abs(zz - z);
if (xOff == mid && zOff == mid && (yOff == 0 || random.nextBoundedInt(2) == 0)) {
continue;
}
if (!Block.solid[level.getBlockIdAt(xx, yy, zz)]) {
level.setBlockIdAt(xx, yy, zz, this.getLeafBlock());
level.setBlockDataAt(xx, yy, zz, this.getType());
}
}
}
}
}
示例2: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
Vector3 v = new Vector3();
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y == -1) {
continue;
}
new ObjectSwampTree().generate(level, random, v.setComponents(x, y, z));
}
}
示例3: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
Vector3 v = new Vector3();
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y == -1) {
continue;
}
new ObjectDarkOakTree().generate(level, random, v.setComponents(x, y, z));
}
}
示例4: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
Vector3 v = new Vector3();
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y == -1) {
continue;
}
new ObjectJungleBigTree(10, 20, new BlockWood(BlockWood.JUNGLE), new BlockLeaves(BlockLeaves.JUNGLE)).generate(this.level, random, v.setComponents(x, y, z));
}
}
示例5: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y != -1 && this.canTallGrassStay(x, y, z)) {
this.level.setBlockIdAt(x, y, z, Block.DOUBLE_PLANT);
this.level.setBlockDataAt(x, y, z, 2);
this.level.setBlockIdAt(x, y + 1, z, Block.DOUBLE_PLANT);
this.level.setBlockDataAt(x, y + 1, z, 10);
}
}
}
示例6: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
Vector3 v = new Vector3();
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y == -1) {
continue;
}
new ObjectSavannaTree().generate(level, random, v.setComponents(x, y, z));
}
}
示例7: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
Vector3 v = new Vector3();
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y == -1) {
continue;
}
new NewJungleTree(4 + random.nextBoundedInt(7)).generate(level, random, v.setComponents(x, y, z));
}
}
示例8: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
Vector3 v = new Vector3();
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y == -1) {
continue;
}
new BigMushroom(type).generate(level, random, v.setComponents(x, y, z));
}
}
示例9: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y != -1 && this.canSugarcaneStay(x, y, z)) {
this.level.setBlockIdAt(x, y, z, Block.SUGARCANE_BLOCK);
this.level.setBlockDataAt(x, y, z, 1);
}
}
}
示例10: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y != -1 && this.canCactusStay(x, y, z)) {
this.level.setBlockIdAt(x, y, z, Block.CACTUS);
this.level.setBlockDataAt(x, y, z, 1);
}
}
}
示例11: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y != -1 && this.canGrassStay(x, y, z)) {
this.level.setBlockIdAt(x, y, z, Block.TALL_GRASS);
this.level.setBlockDataAt(x, y, z, 0);
}
}
}
示例12: populate
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
this.level = level;
int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
for (int i = 0; i < amount; ++i) {
int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
int y = this.getHighestWorkableBlock(x, z);
if (y != -1 && this.canLilyPadStay(x, y, z)) {
this.level.setBlockIdAt(x, y, z, Block.WATER_LILY);
this.level.setBlockDataAt(x, y, z, 1);
}
}
}
示例13: placeObject
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void placeObject(ChunkManager level, int x, int y, int z, NukkitRandom random) {
this.treeHeight = random.nextBoundedInt(3) + 4;
super.placeObject(level, x, y, z, random);
}
示例14: placeObject
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
@Override
public void placeObject(ChunkManager level, int x, int y, int z, NukkitRandom random) {
this.treeHeight = random.nextBoundedInt(6) + 4;
super.placeObject(level, x, y, z, random);
}
示例15: placeVine
import cn.nukkit.math.NukkitRandom; //导入方法依赖的package包/类
private void placeVine(ChunkManager level, NukkitRandom random, Vector3 pos, int meta) {
if (random.nextBoundedInt(3) > 0 && level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) == 0) {
this.setBlockAndNotifyAdequately(level, pos, new BlockVine(meta));
}
}