Java Code Examples for net.minecraft.world.World#checkChunksExist()
The following examples show how to use
net.minecraft.world.World#checkChunksExist() .
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: BlockThinLog.java From GardenCollection with MIT License | 6 votes |
@Override public void breakBlock (World world, int x, int y, int z, Block block, int meta) { byte range = 4; int height = range + 1; if (world.checkChunksExist(x - height, y - height, z - height, x + height, y + height, z + height)) { for (int dx = -range; dx <= range; dx++) { for (int dy = -range; dy <= range; dy++) { for (int dz = -range; dz <= range; dz++) { Block leaf = world.getBlock(x + dx, y + dy, z + dz); if (leaf.isLeaves(world, x + dx, y + dy, z + dz)) leaf.beginLeavesDecay(world, x + dx, y + dy, z + dz); } } } } super.breakBlock(world, x, y, z, block, meta); }
Example 2
Source File: MoCBlockLog.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
/** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { byte var7 = 4; int var8 = var7 + 1; if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { for (int var9 = -var7; var9 <= var7; ++var9) { for (int var10 = -var7; var10 <= var7; ++var10) { for (int var11 = -var7; var11 <= var7; ++var11) { int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); if (Block.blocksList[var12] != null) { Block.blocksList[var12].beginLeavesDecay(par1World, par2 + var9, par3 + var10, par4 + var11); } } } } } }
Example 3
Source File: MoCBlockLeaf.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
public void onBlockRemoval(World world, int i, int j, int k) { int l = 1; int i1 = l + 1; if(world.checkChunksExist(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) { for(int j1 = -l; j1 <= l; j1++) { for(int k1 = -l; k1 <= l; k1++) { for(int l1 = -l; l1 <= l; l1++) { int i2 = world.getBlockId(i + j1, j + k1, k + l1); if(i2 == Block.sapling.blockID) ///////Leaf///////////// { int j2 = world.getBlockMetadata(i + j1, j + k1, k + l1); world.setBlockMetadataWithNotify(i + j1, j + k1, k + l1, j2 | 8,3); } } } } } }
Example 4
Source File: MoCBlockLog.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
/** * Called whenever the block is removed. */ public void onBlockRemoval(World par1World, int par2, int par3, int par4) { byte byte0 = 4; int i = byte0 + 1; if (par1World.checkChunksExist(par2 - i, par3 - i, par4 - i, par2 + i, par3 + i, par4 + i)) { for (int j = -byte0; j <= byte0; j++) { for (int k = -byte0; k <= byte0; k++) { for (int l = -byte0; l <= byte0; l++) { int i1 = par1World.getBlockId(par2 + j, par3 + k, par4 + l); if (i1 != MoCreatures.mocLeaf.blockID) { continue; } int j1 = par1World.getBlockMetadata(par2 + j, par3 + k, par4 + l); if ((j1 & 8) == 0) { par1World.setBlockMetadataWithNotify(par2 + j, par3 + k, par4 + l, j1 | 8, 3); } } } } } }
Example 5
Source File: MoCBlockLeaf.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void updateTick(World world, int i, int j, int k, Random random) { if(world.isRemote) { return; } int l = world.getBlockMetadata(i, j, k); if((l & 8) != 0 && (l & 4) == 0) { byte byte0 = 4; int i1 = byte0 + 1; byte byte1 = 32; int j1 = byte1 * byte1; int k1 = byte1 / 2; if(adjacentTreeBlocks == null) { adjacentTreeBlocks = new int[byte1 * byte1 * byte1]; } if(world.checkChunksExist(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) { for(int l1 = -byte0; l1 <= byte0; l1++) { for(int k2 = -byte0; k2 <= byte0; k2++) { for(int i3 = -byte0; i3 <= byte0; i3++) { int k3 = world.getBlockId(i + l1, j + k2, k + i3); if(k3 == MoCreatures.mocLog.blockID) ///////Log////////////// { adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = 0; continue; } if(k3 == MoCreatures.mocLeaf.blockID) ///////Leaf/////////// { adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -2; } else { adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -1; } } } } for(int i2 = 1; i2 <= 4; i2++) { for(int l2 = -byte0; l2 <= byte0; l2++) { for(int j3 = -byte0; j3 <= byte0; j3++) { for(int l3 = -byte0; l3 <= byte0; l3++) { if(adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] != i2 - 1) { continue; } if(adjacentTreeBlocks[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2; } if(adjacentTreeBlocks[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2; } if(adjacentTreeBlocks[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] = i2; } if(adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] = i2; } if(adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] = i2; } if(adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] = i2; } } } } } } int j2 = adjacentTreeBlocks[k1 * j1 + k1 * byte1 + k1]; if(j2 >= 0) { world.setBlockMetadataWithNotify(i, j, k, l & -9, 3); } else { removeLeaves(world, i, j, k); } } }