本文整理汇总了Java中cn.nukkit.block.Block.getDamage方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getDamage方法的具体用法?Java Block.getDamage怎么用?Java Block.getDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.block.Block
的用法示例。
在下文中一共展示了Block.getDamage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populate
import cn.nukkit.block.Block; //导入方法依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
FullChunk chunk = level.getChunk(chunkX, chunkZ);
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
Biome biome = Biome.getBiome(chunk.getBiomeId(x, z));
Block[] cover = biome.getGroundCover();
if (cover != null && cover.length > 0) {
int diffY = 0;
if (!cover[0].isSolid()) {
diffY = 1;
}
byte[] column = chunk.getBlockIdColumn(x, z);
int y;
for (y = 127; y > 0; --y) {
if (column[y] != 0x00 && !Block.get(column[y] & 0xff).isTransparent()) {
break;
}
}
int startY = Math.min(127, y + diffY);
int endY = startY - cover.length;
for (y = startY; y > endY && y >= 0; --y) {
Block b = cover[startY - y];
if (column[y] == 0x00 && b.isSolid()) {
break;
}
if (b.getDamage() == 0) {
chunk.setBlockId(x, y, z, b.getId());
} else {
chunk.setBlock(x, y, z, b.getId(), b.getDamage());
}
}
}
}
}
}
示例2: useCommand
import cn.nukkit.block.Block; //导入方法依赖的package包/类
public void useCommand() {
if (this.getServer().dispatchCommand(this, getCommand())) {
Block block = getBlock();
Block commandBlock = block.getSide(BlockFace.fromIndex(block.getDamage()));
if (commandBlock instanceof BlockCommandChain) {
if (block.getDamage() == commandBlock.getDamage()) {
BlockEntityCommandBlock blockEntity = ((BlockCommandChain) commandBlock).getBlockEntity();
if (blockEntity != null) {
blockEntity.chainUpdate();
}
}
}
}
}
示例3: TerrainParticle
import cn.nukkit.block.Block; //导入方法依赖的package包/类
public TerrainParticle(Vector3 pos, Block block) {
super(pos, Particle.TYPE_TERRAIN, (block.getDamage() << 8) | block.getId());
}
示例4: DestroyBlockParticle
import cn.nukkit.block.Block; //导入方法依赖的package包/类
public DestroyBlockParticle(Vector3 pos, Block block) {
super(pos.x, pos.y, pos.z);
this.data = block.getId() | (block.getDamage() << 8);
}
示例5: PunchBlockParticle
import cn.nukkit.block.Block; //导入方法依赖的package包/类
public PunchBlockParticle(Vector3 pos, Block block, BlockFace face) {
this(pos, block.getId(), block.getDamage(), face);
}
示例6: toString
import cn.nukkit.block.Block; //导入方法依赖的package包/类
public String toString(Block block) {
if (block.getDamage() == 0) {
return block.getId() + "";
}
return block.getId() + ":" + block.getDamage();
}
示例7: DestroyBlockParticle
import cn.nukkit.block.Block; //导入方法依赖的package包/类
public DestroyBlockParticle(Vector3 pos, Block block) {
super(pos.x, pos.y, pos.z);
this.data = block.getId() + (block.getDamage() << 12);
}