Search in sources :

Example 6 with TileLeaves

use of forestry.arboriculture.tiles.TileLeaves in project ForestryMC by ForestryMC.

the class BlockForestryLeaves method updateTick.

@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
    super.updateTick(world, pos, state, rand);
    TileLeaves tileLeaves = TileUtil.getTile(world, pos, TileLeaves.class);
    // check leaves tile because they might have decayed
    if (tileLeaves != null && !tileLeaves.isInvalid() && rand.nextFloat() <= 0.1) {
        tileLeaves.onBlockTick(world, pos, state, rand);
    }
}
Also used : TileLeaves(forestry.arboriculture.tiles.TileLeaves)

Example 7 with TileLeaves

use of forestry.arboriculture.tiles.TileLeaves in project ForestryMC by ForestryMC.

the class BlockForestryLeaves method getLeafDrop.

@Override
protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
    TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class);
    if (tile == null) {
        return;
    }
    ITree tree = tile.getTree();
    if (tree == null) {
        return;
    }
    // Add saplings
    List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier);
    for (ITree sapling : saplings) {
        if (sapling != null) {
            drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
        }
    }
    // Add fruits
    if (tile.hasFruit()) {
        drops.addAll(tree.produceStacks(world, pos, tile.getRipeningTime()));
    }
}
Also used : TileLeaves(forestry.arboriculture.tiles.TileLeaves) ITree(forestry.api.arboriculture.ITree)

Aggregations

TileLeaves (forestry.arboriculture.tiles.TileLeaves)7 TextureMap (net.minecraft.client.renderer.texture.TextureMap)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 ITree (forestry.api.arboriculture.ITree)1 IToolScoop (forestry.api.core.IToolScoop)1 IButterfly (forestry.api.lepidopterology.IButterfly)1 UnlistedBlockPos (forestry.core.blocks.properties.UnlistedBlockPos)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1 IBlockAccess (net.minecraft.world.IBlockAccess)1 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1