Java Code Examples for net.minecraft.block.Block#isLeaves()
The following examples show how to use
net.minecraft.block.Block#isLeaves() .
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: ForestryReflection.java From Ex-Aliquo with MIT License | 6 votes |
public static void ForestryLeaves(World world, Block block, int meta, int X, int Y, int Z) { if ((forestryLeafBlock != null) && (drops != null)) { try { drops.invoke(forestryLeafBlock.cast(block), world, X, Y, Z, meta, 1.0F, true); } catch (Exception e) { if (!block.isLeaves(world, X, Y, Z)) { e.printStackTrace(); } } } }
Example 2
Source File: WorldGenCandelilla.java From GardenCollection with MIT License | 6 votes |
@Override public boolean generate (World world, Random rand, int x, int y, int z) { do { Block block = world.getBlock(x, y, z); if (!(block.isLeaves(world, x, y, z) || block.isAir(world, x, y, z))) break; y--; } while (y > 0); int range = 5; for (int l = 0; l < 32; ++l) { int x1 = x + rand.nextInt(range) - rand.nextInt(range); int y1 = y + rand.nextInt(4) - rand.nextInt(4); int z1 = z + rand.nextInt(range) - rand.nextInt(range); int level = 1 + rand.nextInt(7); if (world.isAirBlock(x1, y1, z1) && (!world.provider.hasNoSky || y1 < 255) && plantBlock.canBlockStay(world, x1, y1, z1)) world.setBlock(x1, y1, z1, plantBlock, level, 2); } return true; }
Example 3
Source File: WorldGenOrnamentalTree.java From GardenCollection with MIT License | 6 votes |
private void generateBlock (World world, int x, int y, int z, Block block, int meta) { Block existingBlock = world.getBlock(x, y, z); if (existingBlock.isAir(world, x, y, z) || existingBlock.isLeaves(world, x, y, z)) { if (block == Blocks.log) setBlockAndNotifyAdequately(world, x, y, z, ModBlocks.thinLog, meta % 4); else if (block == Blocks.log2) setBlockAndNotifyAdequately(world, x, y, z, ModBlocks.thinLog, meta % 4 + 4); else if (WoodRegistry.instance().contains(block, meta)) { setBlockAndNotifyAdequately(world, x, y, z, block, 0); TileEntityWoodProxy te = new TileEntityWoodProxy(); te.setProtoBlock(block, meta); setBlockAndNotifyAdequately(world, x, y, z, ModBlocks.thinLog, 0); world.setTileEntity(x, y, z, te); } else setBlockAndNotifyAdequately(world, x, y, z, block, meta); } }
Example 4
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 5
Source File: MoCEntityAmbient.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
public boolean getCanSpawnHereJungle() { //System.out.println("checking jungle!"); if (this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox)) { int var1 = MathHelper.floor_double(this.posX); int var2 = MathHelper.floor_double(this.boundingBox.minY); int var3 = MathHelper.floor_double(this.posZ); if (var2 < 63) { return false; } int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); Block block = Block.blocksList[var4]; if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID || (block != null && block.isLeaves(worldObj, var1, var2 - 1, var3))) { return true; } } return false; }
Example 6
Source File: MoCEntityAnimal.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
private boolean getCanSpawnHereMoCBiome() { //System.out.println("checking MoC biome spawn settings"); if (this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox)) { int var1 = MathHelper.floor_double(this.posX); int var2 = MathHelper.floor_double(this.boundingBox.minY); int var3 = MathHelper.floor_double(this.posZ); if (var2 < 50) { return false; } int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); Block block = Block.blocksList[var4]; if (var4 == MoCreatures.mocDirt.blockID || var4 == MoCreatures.mocGrass.blockID || (block != null && block.isLeaves(worldObj, var1, var2 - 1, var3))) { return true; } } return false; }
Example 7
Source File: MoCEntityAnimal.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
public boolean getCanSpawnHereJungle() { //System.out.println("checking jungle!"); if (this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox)) { int var1 = MathHelper.floor_double(this.posX); int var2 = MathHelper.floor_double(this.boundingBox.minY); int var3 = MathHelper.floor_double(this.posZ); if (var2 < 63) { return false; } int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); Block block = Block.blocksList[var4]; if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID || (block != null && block.isLeaves(worldObj, var1, var2 - 1, var3))) { return true; } } return false; }
Example 8
Source File: GTEventNeighborNotifyEvent.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public void onNeighborNotified(BlockEvent.NeighborNotifyEvent event) { World world = event.getWorld(); for (EnumFacing side : event.getNotifiedSides()) { BlockPos sidePos = event.getPos().offset(side); IBlockState sideState = world.getBlockState(sidePos); Block block = sideState.getBlock(); if (block.isLeaves(sideState, world, sidePos)) world.scheduleUpdate(sidePos, block, 8 + world.rand.nextInt(16)); } }
Example 9
Source File: WorldGenAlienTree.java From AdvancedRocketry with MIT License | 5 votes |
private boolean replaceBlockWithWood(World world, int x, int y, int z, EnumFacing direction) { BlockPos pos = new BlockPos(x,y,z); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if( block.isReplaceable(world, pos) || block.isLeaves(state, world, pos) || block == AdvancedRocketryBlocks.blockAlienWood) { this.setBlockAndNotifyAdequately(world, pos, AdvancedRocketryBlocks.blockAlienWood.getDefaultState().withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(direction.getAxis()))); return true; } else return false; }
Example 10
Source File: WorldGenWyvernGrass.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { int var11; Block block = null; do { block = Block.blocksList[par1World.getBlockId(par3, par4, par5)]; if (block != null && !block.isLeaves(par1World, par3, par4, par5)) { break; } par4--; } while (par4 > 0); for (int var7 = 0; var7 < 128; ++var7) { int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); if (par1World.isAirBlock(var8, var9, var10) && Block.blocksList[this.tallGrassID].canBlockStay(par1World, var8, var9, var10)) { par1World.setBlock(var8, var9, var10, this.tallGrassID, this.tallGrassMetadata, 3); } } return true; }
Example 11
Source File: GoldCrook.java From Ex-Aliquo with MIT License | 4 votes |
@Override public boolean onBlockStartBreak(ItemStack item, int X, int Y, int Z, EntityPlayer player) { World world = player.worldObj; int blockID = world.getBlockId(X,Y,Z); int meta = world.getBlockMetadata(X, Y, Z); boolean validTarget = false; boolean extraDropped = false; Block block = Block.blocksList[blockID]; if (block.isLeaves(null, 0, 0, 0)) { if (!world.isRemote) { if (forestryrefcheck && ModsLoaded.isForestryLoaded) { ForestryLeaves(world, block, meta, X, Y, Z); ForestryLeaves(world, block, meta, X, Y, Z); ForestryLeaves(world, block, meta, X, Y, Z); } if (!extras) { block.dropBlockAsItem(world, X, Y, Z, meta, 0); block.dropBlockAsItem(world, X, Y, Z, meta, 0); block.dropBlockAsItem(world, X, Y, Z, meta, 0); } if (ModData.ALLOW_SILKWORMS && world.rand.nextInt(75) == 0) { world.spawnEntityInWorld(new EntityItem(world, X + 0.5D, Y + 0.5D, Z + 0.5D, new ItemStack(getItem(Info.silkworm), 1, 0))); } } } if (blockID == getIDs(Info.silkleaves)) { if (!world.isRemote) { if (ModData.ALLOW_SILKWORMS && world.rand.nextInt(10) == 0) { world.spawnEntityInWorld(new EntityItem(world, X + 0.5D, Y + 0.5D, Z + 0.5D, new ItemStack(getItem(Info.silkworm), 1, 0))); } } } return false; }
Example 12
Source File: WorldGenOrnamentalTree.java From GardenCollection with MIT License | 4 votes |
private void generateBlock (World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); if (block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z)) setBlockAndNotifyAdequately(world, x, y, z, leaves, metaLeaves); }