@Override public void afterBlockBreak(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase player, int damage, boolean wasEffective) { // breaking leaves does not reduce durability if(state.getBlock().isLeaves(state, world, pos)) { damage = 0; } super.afterBlockBreak(stack, world, state, pos, player, damage, wasEffective); }
protected void placeTrunk(World world, BlockPos pos, int height) { while(height >= 0) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(block.isAir(state, world, pos) || block.isReplaceable(world, pos) || block.isLeaves(state, world, pos)) { this.setBlockAndMetadata(world, pos, log); } pos = pos.up(); height--; } }
BlockPos leaf = pos.add(o + x, o + y, o + z); IBlockState state = world.getBlockState(leaf); if(state.getBlock().isLeaves(state, world, leaf)) { if(++leaves >= 5) { return true;
boolean isLeaf = block.isLeaves(world.getBlockState(adj), world, adj);
? ((IHornHarvestable) block).canHornHarvest(world, pos, stack, type) : stackDmg == 0 && block instanceof BlockBush && !(block instanceof ISpecialFlower) || stackDmg == 1 && block.isLeaves(world.getBlockState(pos), world, pos) || stackDmg == 2 && block == Blocks.SNOW_LAYER) coords.add(pos);
private static boolean isBlockLeaves(World world, BlockPos blockPos) { IBlockState blockState = world.getBlockState(blockPos); final Block block = blockState.getBlock(); return block.isLeaves(blockState, world, blockPos); }
public static boolean isTreeBlock(IBlockState blockState, World world, BlockPos pos) { Block block = blockState.getBlock(); return block.isLeaves(blockState, world, pos) || block.isWood(world, pos); }
@Override public int convertBlockDrops(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer harvester, List<ItemStack> drops, boolean recursive) { if (blockState.getBlock().isLeaves(blockState, world, blockPos)) { drops.clear(); //clear previous drops to avoid possible issues NonNullList<ItemStack> dropsNonNull = NonNullList.create(); blockState.getBlock().getDrops(dropsNonNull, world, blockPos, blockState, 10); drops.addAll(dropsNonNull); } return 0; }
@Override @ModDependentMethod(modId = LPConstants.mcmpModID) public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos) { Block block = mcmpBlockAccess.getBlock(); return block != null ? block.isLeaves(state, world, pos) : super.isLeaves(state, world, pos); }
public boolean isReplaceable(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isReplaceable(world, pos) || state.getBlock().isWood(world, pos) || this.canGrowInto(state.getBlock()); }
private static int getYForCocoon(World world, int x, int z) { int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1; BlockPos pos = new BlockPos(x, y, z); IBlockState blockState = world.getBlockState(pos); if (!blockState.getBlock().isLeaves(blockState, world, pos)) { return -1; } do { pos = pos.down(); blockState = world.getBlockState(pos); } while (blockState.getBlock().isLeaves(blockState, world, pos)); return y; }
/** * Returns whether the block can be blown by the leaf blower. * @param block The block * @param world The world * @param pos The block's position * @return Whether the leaf blower should blow this block away. */ public static boolean isLeaves(Block block, World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); return (OreDictHelper.listHasItem(OreDictHelper.leaves, Item.getItemFromBlock(block)) || block.isLeaves(state, world, pos) || LEAF_MATERIALS.contains(block.getMaterial(state))); }
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos.down()); Block block = iblockstate.getBlock(); if (block != Blocks.ICE && block != Blocks.PACKED_ICE && block != Blocks.BARRIER) { BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP); return blockfaceshape == BlockFaceShape.SOLID || iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) || block == this && ((Integer) iblockstate.getValue(LAYERS)).intValue() == 8; } else { return false; } }
public static boolean isValidLocation(World world, BlockPos pos) { BlockPos posAbove = pos.up(); IBlockState blockStateAbove = world.getBlockState(posAbove); Block blockAbove = blockStateAbove.getBlock(); if (!blockAbove.isLeaves(blockStateAbove, world, posAbove)) { return false; } BlockPos posBelow = pos.down(); IBlockState blockStateBelow = world.getBlockState(posBelow); return BlockUtil.canReplace(blockStateBelow, world, posBelow); } }
public static boolean canPlaceTree(IBlockState blockState, World world, BlockPos pos) { BlockPos downPos = pos.down(); Block block = world.getBlockState(downPos).getBlock(); return !(block.isReplaceable(world, downPos) && blockState.getMaterial().isLiquid()) && !block.isLeaves(blockState, world, downPos) && !block.isWood(world, downPos); }
public boolean canConnectFenceTo(IBlockAccess world, BlockPos pos) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); return block == this || canConnectTo(world, pos) || block.isLeaves(state, world, pos) || (state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD); }
private void generateTrunk(World parWorld, BlockPos parBlockPos, int minHeight) { for (int height = 0; height < minHeight; ++height) { BlockPos upN = parBlockPos.up(height); IBlockState state = parWorld.getBlockState(upN); if (state.getBlock().isAir(state, parWorld, upN) || state.getBlock().isLeaves(state, parWorld, upN)) { setBlockAndNotifyAdequately(parWorld, parBlockPos.up(height), blockStateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y)); } } }
@Override public boolean canPlaceBlockAt(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos.down()); if (state.getBlock() == null) return false; if (state.getBlock() == this) return true; if (state.getBlock().isLeaves(state, world, pos.down()) && !state.isOpaqueCube()) return false; return state.getMaterial().blocksMovement(); }
IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); if(iblockstate1.getBlock().isLeaves(iblockstate1, worldIn, blockpos1)) { iblockstate1.getBlock().beginLeavesDecay(iblockstate1, worldIn, blockpos1);
@Override public boolean canPlaceBlockAt(World world, BlockPos blockPos) { IBlockState blockState = world.getBlockState(blockPos.add(0, -1, 0)); if (blockState == null) return false; if (blockState.getBlock() == this && (Integer) blockState.getValue(LAYERS) == 8) return true; return (blockState.getBlock().isLeaves(blockState, world, blockPos.add(0, -1, 0)) || blockState.isOpaqueCube()) && blockState.getBlock().getMaterial(blockState).blocksMovement(); }