Java Code Examples for cn.nukkit.block.Block#AIR
The following examples show how to use
cn.nukkit.block.Block#AIR .
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: HugeTreesGenerator.java From Nukkit with GNU General Public License v3.0 | 6 votes |
protected void growLeavesLayer(ChunkManager worldIn, Vector3 layerCenter, int width) { int i = width * width; for (int j = -width; j <= width; ++j) { for (int k = -width; k <= width; ++k) { if (j * j + k * k <= i) { Vector3 blockpos = layerCenter.add(j, 0, k); int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z); if (id == Block.AIR || id == Block.LEAVES) { this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); } } } } }
Example 2
Source File: ObjectTallGrass.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public static void growGrass(ChunkManager level, Vector3 pos, NukkitRandom random, int count, int radius) { int[][] arr = { {Block.DANDELION, 0}, {Block.POPPY, 0}, {Block.TALL_GRASS, 1}, {Block.TALL_GRASS, 1}, {Block.TALL_GRASS, 1}, {Block.TALL_GRASS, 1} }; int arrC = arr.length - 1; for (int c = 0; c < count; c++) { int x = random.nextRange((int) (pos.x - radius), (int) (pos.x + radius)); int z = random.nextRange((int) (pos.z) - radius, (int) (pos.z + radius)); if (level.getBlockIdAt(x, (int) (pos.y + 1), z) == Block.AIR && level.getBlockIdAt(x, (int) (pos.y), z) == Block.GRASS) { int[] t = arr[random.nextRange(0, arrC)]; level.setBlockIdAt(x, (int) (pos.y + 1), z, t[0]); level.setBlockDataAt(x, (int) (pos.y + 1), z, t[1]); } } }
Example 3
Source File: EntityFishingHook.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public int getWaterHeight() { for (int y = this.getFloorY(); y < 256; y++) { int id = this.level.getBlockIdAt(this.getFloorX(), y, this.getFloorZ()); if (id == Block.AIR) { return y; } } return this.getFloorY(); }
Example 4
Source File: PopulatorLilyPad.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y >= 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b != Block.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) { break; } } return y == 0 ? -1 : ++y; }
Example 5
Source File: PopulatorDeadBush.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y >= 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b != Block.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) { break; } } return y == 0 ? -1 : ++y; }
Example 6
Source File: ObjectSwampTree.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private void addHangingVine(ChunkManager worldIn, BlockVector3 pos, int meta) { this.addVine(worldIn, pos, meta); int i = 4; for (pos = pos.down(); i > 0 && worldIn.getBlockIdAt(pos.x, pos.y, pos.z) == Block.AIR; --i) { this.addVine(worldIn, pos, meta); pos = pos.down(); } }
Example 7
Source File: PopulatorTallSugarcane.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y >= 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b != Block.AIR && b != Block.LEAVES && b != Block.LEAVES2) { break; } } return y == 0 ? -1 : ++y; }
Example 8
Source File: ObjectSavannaTree.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private void placeLeafAt(ChunkManager worldIn, Vector3 pos) { int material = worldIn.getBlockIdAt(pos.getFloorX(), pos.getFloorY(), pos.getFloorZ()); if (material == Block.AIR || material == Block.LEAVES) { this.setBlockAndNotifyAdequately(worldIn, pos, LEAF); } }
Example 9
Source File: SavannaTreePopulator.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y > 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b == Block.DIRT || b == Block.GRASS) { break; } else if (b != Block.AIR && b != Block.SNOW_LAYER) { return -1; } } return ++y; }
Example 10
Source File: PopulatorTree.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y > 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b == Block.DIRT || b == Block.GRASS) { break; } else if (b != Block.AIR && b != Block.SNOW_LAYER) { return -1; } } return ++y; }
Example 11
Source File: PopulatorGrass.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y >= 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b != Block.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) { break; } } return y == 0 ? -1 : ++y; }
Example 12
Source File: MushroomPopulator.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y > 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b == Block.DIRT || b == Block.GRASS) { break; } else if (b != Block.AIR && b != Block.SNOW_LAYER) { return -1; } } return ++y; }
Example 13
Source File: ObjectSwampTree.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private void addHangingVine(ChunkManager worldIn, BlockVector3 pos, int meta) { this.addVine(worldIn, pos, meta); int i = 4; for (pos = pos.down(); i > 0 && worldIn.getBlockIdAt(pos.x, pos.y, pos.z) == Block.AIR; --i) { this.addVine(worldIn, pos, meta); pos = pos.down(); } }
Example 14
Source File: SwampTreePopulator.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(int x, int z) { int y; for (y = 127; y > 0; --y) { int b = this.level.getBlockIdAt(x, y, z); if (b == Block.DIRT || b == Block.GRASS) { break; } else if (b != Block.AIR && b != Block.SNOW_LAYER) { return -1; } } return ++y; }
Example 15
Source File: ObjectSavannaTree.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private void placeLeafAt(ChunkManager worldIn, Vector3 pos) { int material = worldIn.getBlockIdAt(pos.getFloorX(), pos.getFloorY(), pos.getFloorZ()); if (material == Block.AIR || material == Block.LEAVES) { this.setBlockAndNotifyAdequately(worldIn, pos, LEAF); } }
Example 16
Source File: PopulatorGlowStone.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private int getHighestWorkableBlock(FullChunk chunk, int x, int z) { int y; //start scanning a bit lower down to allow space for placing on top for (y = 120; y >= 0; y--) { int b = chunk.getBlockId(x, y, z); if (b == Block.AIR) { break; } } return y == 0 ? -1 : y; }
Example 17
Source File: PopulatorFlower.java From Nukkit with GNU General Public License v3.0 | 4 votes |
private boolean canFlowerStay(int x, int y, int z) { int b = this.level.getBlockIdAt(x, y, z); return (b == Block.AIR || b == Block.SNOW_LAYER) && this.level.getBlockIdAt(x, y - 1, z) == Block.GRASS; }
Example 18
Source File: PopulatorDeadBush.java From Jupiter with GNU General Public License v3.0 | 4 votes |
private boolean canDeadBushStay(int x, int y, int z) { int b = this.level.getBlockIdAt(x, y, z); return (b == Block.AIR && this.level.getBlockIdAt(x, y - 1, z) == Block.SAND); }
Example 19
Source File: PopulatorDeadBush.java From Nukkit with GNU General Public License v3.0 | 4 votes |
private boolean canDeadBushStay(int x, int y, int z) { int b = this.level.getBlockIdAt(x, y, z); return (b == Block.AIR && this.level.getBlockIdAt(x, y - 1, z) == Block.SAND); }
Example 20
Source File: PopulatorLava.java From Nukkit with GNU General Public License v3.0 | 4 votes |
private void flowIntoBlock(int x, int y, int z, int newFlowDecay) { if (this.level.getBlockIdAt(x, y, z) == Block.AIR) { this.level.setBlockAt(x, y, z, Block.LAVA, newFlowDecay); this.lavaSpread(x, y, z); } }