Prevent saplings from dropping if their item is null. Closes #731

This commit is contained in:
Adubbz 2016-04-04 09:41:26 +10:00
parent a6e24ab4d4
commit ff45984c2d

View file

@ -11,6 +11,8 @@ package biomesoplenty.common.block;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import com.google.common.collect.Lists;
import biomesoplenty.api.block.BOPBlocks.Coloring; import biomesoplenty.api.block.BOPBlocks.Coloring;
import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.item.BOPItems; 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; return treeType.hasSapling() ? BlockBOPSapling.paging.getVariantItem(treeType).getItemDamage() : 0;
} }
@Override
public java.util.List<ItemStack> 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? // TODO: different fruits for different trees?
@Override @Override
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)