Java Code Examples for cn.nukkit.level.Position#getFloorZ()
The following examples show how to use
cn.nukkit.level.Position#getFloorZ() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EssentialsAPI.java From EssentialsNK with GNU General Public License v3.0 | 5 votes |
public Position getStandablePositionAt(Position pos) { int x = pos.getFloorX(); int y = pos.getFloorY() + 1; int z = pos.getFloorZ(); for (; y <= 128; y++) { if (!pos.level.getBlock(this.temporalVector.setComponents(x, y, z)).isSolid() && !pos.level.getBlock(this.temporalVector.setComponents(x, y + 1, z)).isSolid()) { return new Position(x + 0.5, pos.level.getBlock(this.temporalVector.setComponents(x, y - 1, z)).getBoundingBox().getMaxY(), z + 0.5, pos.level); } } return null; }
Example 2
Source File: EssentialsAPI.java From EssentialsNK with GNU General Public License v3.0 | 5 votes |
public Position getHighestStandablePositionAt(Position pos) { int x = pos.getFloorX(); int z = pos.getFloorZ(); for (int y = 127; y >= 0; y--) { if (pos.level.getBlock(this.temporalVector.setComponents(x, y, z)).isSolid()) { return new Position(x + 0.5, pos.level.getBlock(this.temporalVector.setComponents(x, y, z)).getBoundingBox().getMaxY(), z + 0.5, pos.level); } } return null; }
Example 3
Source File: NukkitQueue.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public void sendChunk(int x, int z, int bitMask) { Collection<Player> players = faweNukkit.getPlugin().getServer().getOnlinePlayers().values(); int view = faweNukkit.getPlugin().getServer().getViewDistance(); for (Player player : players) { Position pos = player.getPosition(); int pcx = pos.getFloorX() >> 4; int pcz = pos.getFloorZ() >> 4; if (Math.abs(pcx - x) > view || Math.abs(pcz - z) > view) { continue; } world.requestChunk(x, z, player); } }
Example 4
Source File: BlockNetherPortal.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public static void spawnPortal(Position pos) { Level lvl = pos.level; int x = pos.getFloorX(), y = pos.getFloorY(), z = pos.getFloorZ(); for (int xx = -1; xx < 4; xx++) { for (int yy = 1; yy < 4; yy++) { for (int zz = -1; zz < 3; zz++) { lvl.setBlockAt(x + xx, y + yy, z + zz, AIR); } } } lvl.setBlockAt(x + 1, y, z, OBSIDIAN); lvl.setBlockAt(x + 2, y, z, OBSIDIAN); z += 1; lvl.setBlockAt(x, y, z, OBSIDIAN); lvl.setBlockAt(x + 1, y, z, OBSIDIAN); lvl.setBlockAt(x + 2, y, z, OBSIDIAN); lvl.setBlockAt(x + 3, y, z, OBSIDIAN); z += 1; lvl.setBlockAt(x + 1, y, z, OBSIDIAN); lvl.setBlockAt(x + 2, y, z, OBSIDIAN); z -= 1; y += 1; lvl.setBlockAt(x, y, z, OBSIDIAN); lvl.setBlockAt(x + 1, y, z, NETHER_PORTAL); lvl.setBlockAt(x + 2, y, z, NETHER_PORTAL); lvl.setBlockAt(x + 3, y, z, OBSIDIAN); y += 1; lvl.setBlockAt(x, y, z, OBSIDIAN); lvl.setBlockAt(x + 1, y, z, NETHER_PORTAL); lvl.setBlockAt(x + 2, y, z, NETHER_PORTAL); lvl.setBlockAt(x + 3, y, z, OBSIDIAN); y += 1; lvl.setBlockAt(x, y, z, OBSIDIAN); lvl.setBlockAt(x + 1, y, z, NETHER_PORTAL); lvl.setBlockAt(x + 2, y, z, NETHER_PORTAL); lvl.setBlockAt(x + 3, y, z, OBSIDIAN); y += 1; lvl.setBlockAt(x, y, z, OBSIDIAN); lvl.setBlockAt(x + 1, y, z, OBSIDIAN); lvl.setBlockAt(x + 2, y, z, OBSIDIAN); lvl.setBlockAt(x + 3, y, z, OBSIDIAN); }