本文整理汇总了Java中ethanjones.cubes.core.util.ThreadRandom类的典型用法代码示例。如果您正苦于以下问题:Java ThreadRandom类的具体用法?Java ThreadRandom怎么用?Java ThreadRandom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThreadRandom类属于ethanjones.cubes.core.util包,在下文中一共展示了ThreadRandom类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tick
import ethanjones.cubes.core.util.ThreadRandom; //导入依赖的package包/类
public void tick() {
if (Side.isServer()) {
AreaMap areaMap = areaMap();
if (!featuresGenerated() || areaMap == null)
return;
ThreadRandom random = ThreadRandom.get();
lock.writeLock();
int updates = NUM_RANDOM_UPDATES * height;
for (int i = 0; i < updates; i++) {
int randomX = random.nextInt(SIZE_BLOCKS);
int randomZ = random.nextInt(SIZE_BLOCKS);
int randomY = random.nextInt(maxY + 1);
randomTick(randomX, randomY, randomZ, areaMap);
}
for (BlockData blockData : blockDataList) {
blockData.update();
}
lock.writeUnlock();
}
}
示例2: tick
import ethanjones.cubes.core.util.ThreadRandom; //导入依赖的package包/类
public void tick() {
if (Side.isServer()) {
AreaMap areaMap = areaMap();
if (!featuresGenerated() || areaMap == null) return;
ThreadRandom random = ThreadRandom.get();
lock.writeLock();
int updates = NUM_RANDOM_UPDATES * height;
for (int i = 0; i < updates; i++) {
int randomX = random.nextInt(SIZE_BLOCKS);
int randomZ = random.nextInt(SIZE_BLOCKS);
int randomY = random.nextInt(maxY + 1);
randomTick(randomX, randomY, randomZ, areaMap);
}
for (BlockData blockData : blockDataList) {
blockData.update();
}
lock.writeUnlock();
}
}
示例3: randomTick
import ethanjones.cubes.core.util.ThreadRandom; //导入依赖的package包/类
@Override
public int randomTick(World world, Area area, int x, int y, int z, int meta) {
if ((world.isDay() && area.getSunlight(x, y + 1, z) >= 10) || area.getLight(x, y + 1, z) >= 10) {
if (meta >= 7) {
new TreeGenerator().generateTree(x + area.minBlockX, y, z + area.minBlockZ,
3 + ThreadRandom.get().nextInt(3), area);
} else {
meta++;
}
}
return meta;
}
示例4: drops
import ethanjones.cubes.core.util.ThreadRandom; //导入依赖的package包/类
@Override
public ItemStack[] drops(World world, int x, int y, int z, int meta) {
boolean sapling = ThreadRandom.get().nextInt(24) == 0;
boolean leaves = ThreadRandom.get().nextInt(6) == 0;
if (sapling && leaves) {
return new ItemStack[] { new ItemStack(Blocks.sapling.getItemBlock()),
new ItemStack(Blocks.leaves.getItemBlock()) };
} else if (sapling) {
return new ItemStack[] { new ItemStack(Blocks.sapling.getItemBlock()) };
} else if (leaves) {
return new ItemStack[] { new ItemStack(Blocks.leaves.getItemBlock()) };
} else {
return new ItemStack[0];
}
}
示例5: randomTick
import ethanjones.cubes.core.util.ThreadRandom; //导入依赖的package包/类
@Override
public int randomTick(World world, Area area, int x, int y, int z, int meta) {
if ((world.isDay() && area.getSunlight(x, y + 1, z) >= 10) || area.getLight(x, y + 1, z) >= 10) {
if (meta >= 7) {
new TreeGenerator().generateTree(x + area.minBlockX, y, z + area.minBlockZ, 3 + ThreadRandom.get().nextInt(3), area);
} else {
meta++;
}
}
return meta;
}
示例6: drops
import ethanjones.cubes.core.util.ThreadRandom; //导入依赖的package包/类
@Override
public ItemStack[] drops(World world, int x, int y, int z, int meta) {
boolean sapling = ThreadRandom.get().nextInt(24) == 0;
boolean leaves = ThreadRandom.get().nextInt(6) == 0;
if (sapling && leaves) {
return new ItemStack[]{new ItemStack(Blocks.sapling.getItemBlock()), new ItemStack(Blocks.leaves.getItemBlock())};
} else if (sapling) {
return new ItemStack[]{new ItemStack(Blocks.sapling.getItemBlock())};
} else if (leaves) {
return new ItemStack[]{new ItemStack(Blocks.leaves.getItemBlock())};
} else {
return new ItemStack[0];
}
}