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);
}
}
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()));
}
}
Aggregations