本文整理了Java中org.bukkit.block.Block.getZ()
方法的一些代码示例,展示了Block.getZ()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getZ()
方法的具体详情如下:
包路径:org.bukkit.block.Block
类名称:Block
方法名:getZ
[英]Gets the z-coordinate of this block
[中]获取此块的z坐标
代码示例来源:origin: Bukkit/Bukkit
private boolean blockEquals(Block a, Block b) {
return a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ();
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public Chunk getChunkAt(Block block) {
return getChunkAt(block.getX() >> 4, block.getZ() >> 4);
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public void getChunkAtAsync(Block block, ChunkLoadCallback cb) {
getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, cb);
}
代码示例来源:origin: Bukkit/Bukkit
private double getZPosition(Vector direction, Vector position, Block block) {
return getPosition(direction.getZ(), position.getZ(), block.getZ());
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
protected String disambiguate(Block subject, String metadataKey) {
return subject.getWorld() + "," + subject.getX() + "," + subject.getY() + "," + subject
.getZ() + ":" + metadataKey;
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Checks whether the entity is within the specified distance from the block.
*
* @param entity the entity
* @param block the block
* @param x maximum distance on x axis
* @param y maximum distance on y axis
* @param z maximum distance on z axis
* @return Whether the entity is within distance
*/
private boolean isWithinDistance(Entity entity, Block block, int x, int y, int z) {
Location loc = entity.getLocation();
return Math.abs(loc.getX() - block.getX()) <= x
&& Math.abs(loc.getY() - block.getY()) <= y
&& Math.abs(loc.getZ() - block.getZ()) <= z;
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
public static boolean isRainy(Block block) {
return isRainy(block.getBiome(), block.getX(), block.getY(), block.getZ());
}
代码示例来源:origin: GlowstoneMC/Glowstone
public static boolean isCold(Block block) {
return isCold(block.getBiome(), block.getX(), block.getY(), block.getZ());
}
代码示例来源:origin: GlowstoneMC/Glowstone
public static boolean isSnowy(Block block) {
return isSnowy(block.getBiome(), block.getX(), block.getY(), block.getZ());
}
代码示例来源:origin: GlowstoneMC/Glowstone
private void addCocoa(int sourceX, int sourceY, int sourceZ, World world, Random random) {
if (height > 5 && random.nextInt(5) == 0) {
for (int y = 0; y < 2; y++) {
for (BlockFace cocoaFace : COCOA_FACES) { // rotate the 4 trunk faces
if (random.nextInt(COCOA_FACES.length - y)
== 0) { // higher it is, more chances there is
CocoaPlantSize size = COCOA_SIZE[random.nextInt(COCOA_SIZE.length)];
Block block = delegate
.getBlockState(world, sourceX, sourceY + height - 5 + y,
sourceZ)
.getBlock().getRelative(cocoaFace);
delegate.setTypeAndData(world, block.getX(), block.getY(),
block.getZ(),
Material.COCOA, new CocoaPlant(size, cocoaFace.getOppositeFace()));
}
}
}
}
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Creates a bounding box that is effectively the entire given block.
* @param block the block
*/
public BlockBoundingBox(Block block) {
minCorner.setX(block.getX());
minCorner.setY(block.getY());
minCorner.setZ(block.getZ());
maxCorner.setX(block.getX() + 1);
maxCorner.setY(block.getY() + 0.95);
maxCorner.setZ(block.getZ() + 1);
}
代码示例来源:origin: GlowstoneMC/Glowstone
private void setType(Block block, int type, int data) {
World world = block.getWorld();
int x = block.getX();
int y = block.getY();
int z = block.getZ();
GlowChunk chunk = (GlowChunk) world.getChunkAt(block);
chunk.setType(x & 0xf, z & 0xf, y, type);
chunk.setMetaData(x & 0xf, z & 0xf, y, data);
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public BlockFace getFace(Block block) {
for (BlockFace face : BlockFace.values()) {
if (x + face.getModX() == block.getX() && y + face.getModY() == block.getY()
&& z + face.getModZ() == block.getZ()) {
return face;
}
}
return null;
}
代码示例来源:origin: EngineHub/WorldEdit
if (action == Action.LEFT_CLICK_BLOCK) {
final Block clickedBlock = event.getClickedBlock();
final Location pos = new Location(world, clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
final Location pos = new Location(world, clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
代码示例来源:origin: EngineHub/WorldGuard
private static String toBlockString(List<Block> blocks) {
StringBuilder builder = new StringBuilder();
boolean first = true;
for (Block block : blocks) {
if (!first) {
builder.append("|");
}
builder.append(block.getX()).append(",").append(block.getY()).append(",").append(block.getZ());
first = false;
}
return builder.toString();
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
/**
* (convenience method, uses cache).
*
* @param block
* the block
* @return the type id
*/
public Material getType(final Block block) {
return getType(block.getX(), block.getY(), block.getZ());
}
代码示例来源:origin: mcMMO-Dev/mcMMO
@Override
public synchronized void setFalse(Block block) {
if (block == null) {
return;
}
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld());
}
代码示例来源:origin: mcMMO-Dev/mcMMO
@Override
public synchronized void setTrue(Block block) {
if (block == null) {
return;
}
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
}
代码示例来源:origin: mcMMO-Dev/mcMMO
@Override
public synchronized boolean isTrue(Block block) {
if (block == null) {
return false;
}
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
}
代码示例来源:origin: MylesIsCool/ViaVersion
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void placeBlock(BlockPlaceEvent e) {
if (isOnPipe(e.getPlayer())) {
Block b = e.getBlockPlaced();
getUserConnection(e.getPlayer())
.get(EntityTracker.class)
.addBlockInteraction(new Position((long) b.getX(), (long) b.getY(), (long) b.getZ()));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!