From ff45984c2deceeb11d6852567b900d09a6561336 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Mon, 4 Apr 2016 09:41:26 +1000 Subject: [PATCH] Prevent saplings from dropping if their item is null. Closes #731 --- .../common/block/BlockBOPLeaves.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java index 175e30176..ef401d08d 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java @@ -11,6 +11,8 @@ package biomesoplenty.common.block; import java.util.List; import java.util.Random; +import com.google.common.collect.Lists; + import biomesoplenty.api.block.BOPBlocks.Coloring; import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.item.BOPItems; @@ -225,6 +227,20 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock return treeType.hasSapling() ? BlockBOPSapling.paging.getVariantItem(treeType).getItemDamage() : 0; } + @Override + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + BOPTrees treeType = ((BOPTrees) state.getValue(this.variantProperty)); + + if (treeType.hasSapling()) + { + return super.getDrops(world, pos, state, fortune); + } + + //Tree types without saplings shouldn't drop apples either + return Lists.newArrayList(); + } + // TODO: different fruits for different trees? @Override protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)