本文整理汇总了Java中cn.nukkit.block.Block.solid方法的典型用法代码示例。如果您正苦于以下问题:Java Block.solid方法的具体用法?Java Block.solid怎么用?Java Block.solid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.block.Block
的用法示例。
在下文中一共展示了Block.solid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: placeObject
import cn.nukkit.block.Block; //导入方法依赖的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: populateSkyLight
import cn.nukkit.block.Block; //导入方法依赖的package包/类
@Override
public void populateSkyLight() {
for (int z = 0; z < 16; ++z) {
for (int x = 0; x < 16; ++x) {
int top = this.getHeightMap(x, z);
for (int y = 255; y > top; --y) {
this.setBlockSkyLight(x, y, z, 15);
}
for (int y = top; y >= 0; --y) {
if (Block.solid[this.getBlockId(x, y, z)]) {
break;
}
this.setBlockSkyLight(x, y, z, 15);
}
this.setHeightMap(x, z, this.getHighestBlockAt(x, z, false));
}
}
}
示例3: placeObject
import cn.nukkit.block.Block; //导入方法依赖的package包/类
@Override
public void placeObject(ChunkManager level, int x, int y, int z, NukkitRandom random) {
this.treeHeight = random.nextBoundedInt(4) + 6;
int topSize = this.getTreeHeight() - (1 + random.nextBoundedInt(2));
int lRadius = 2 + random.nextBoundedInt(2);
this.placeTrunk(level, x, y, z, random, this.getTreeHeight() - random.nextBoundedInt(3));
int radius = random.nextBoundedInt(2);
int maxR = 1;
int minR = 0;
for (int yy = 0; yy <= topSize; ++yy) {
int yyy = y + this.treeHeight - yy;
for (int xx = x - radius; xx <= x + radius; ++xx) {
int xOff = Math.abs(xx - x);
for (int zz = z - radius; zz <= z + radius; ++zz) {
int zOff = Math.abs(zz - z);
if (xOff == radius && zOff == radius && radius > 0) {
continue;
}
if (!Block.solid[level.getBlockIdAt(xx, yyy, zz)]) {
level.setBlockIdAt(xx, yyy, zz, this.getLeafBlock());
level.setBlockDataAt(xx, yyy, zz, this.getType());
}
}
}
if (radius >= maxR) {
radius = minR;
minR = 1;
if (++maxR > lRadius) {
maxR = lRadius;
}
} else {
++radius;
}
}
}