Java Code Examples for org.bukkit.Chunk#getBlock()
The following examples show how to use
org.bukkit.Chunk#getBlock() .
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: CaveOresOnlyPopulator.java From UhcCore with GNU General Public License v3.0 | 6 votes |
private void scanChunk(Chunk chunk){ for (int x = 0; x < 16; x++){ for (int y = 5; y < 30; y++){ for (int z = 0; z < 16; z++){ Block block = chunk.getBlock(x, y, z); Material type = block.getType(); if ( type == Material.DIAMOND_ORE || type == Material.GOLD_ORE || type == Material.LAPIS_ORE ){ Vein vein = new Vein(); vein.process(block); if (!vein.isConnectedToAir()){ vein.setToStone(); } } } } } }
Example 2
Source File: BiomeTypePopulator.java From UhcCore with GNU General Public License v3.0 | 6 votes |
@Override public void populate(World world, Random random, Chunk chunk){ for (int x = 1; x < 15; x++) { for (int z = 1; z < 15; z++) { Block block = chunk.getBlock(x, 1, z); Biome replacementBiome = getReplacementBiome(block.getBiome()); if (UhcCore.getVersion() < 16){ if (replacementBiome != null) { block.setBiome(replacementBiome); } }else { for (int y = 0; y < 200; y++) { block = chunk.getBlock(x, y, z); if (replacementBiome != null) { block.setBiome(replacementBiome); } } } } } }
Example 3
Source File: BukkitBlockConnectionProvider.java From ViaVersion with MIT License | 6 votes |
@Override public int getWorldBlockData(UserConnection user, int bx, int by, int bz) { UUID uuid = user.getProtocolInfo().getUuid(); Player player = Bukkit.getPlayer(uuid); if (player != null) { World world = player.getWorld(); int x = bx >> 4; int z = bz >> 4; if (world.isChunkLoaded(x, z)) { Chunk c = getChunk(world, x, z); Block b = c.getBlock(bx, by, bz); return b.getTypeId() << 4 | b.getData(); } } return 0; }
Example 4
Source File: CraftWorld.java From Thermos with GNU General Public License v3.0 | 4 votes |
public Block getBlockAt(int x, int y, int z) { Chunk chunk = getChunkAt(x >> 4, z >> 4); return chunk == null ? null : chunk.getBlock(x & 0xF, y & 0xFF, z & 0xF); }