From 555e96af8114bdeb3a8b11db53e92c10b0053b11 Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Sat, 23 May 2015 00:02:50 +0100 Subject: [PATCH] Remove reliance on hard coded sapling values in leaf drop code --- .../biomesoplenty/common/block/BlockBOPLeaves.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java index f2b1a6559..8f712a20b 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java @@ -11,7 +11,6 @@ package biomesoplenty.common.block; import java.util.List; import java.util.Random; -import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.common.enums.BOPTrees; import biomesoplenty.common.item.ItemBOPBlock; @@ -134,24 +133,19 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock return 20; } - // TODO: use some kind of mapping to saplings @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { BOPTrees treeType = ((BOPTrees) state.getValue(this.variantProperty)); - int saplingPage = treeType.ordinal() / 8; - if (saplingPage == 2) {return Item.getItemFromBlock(BOPBlocks.sapling_2);} - if (saplingPage == 1) {return Item.getItemFromBlock(BOPBlocks.sapling_1);} - return Item.getItemFromBlock(BOPBlocks.sapling_0); + return Item.getItemFromBlock( BlockBOPSapling.paging.getBlock(treeType) ); } - // TODO: use some kind of mapping to saplings @Override public int damageDropped(IBlockState state) { - //Ignore all other properties, only the variant is important to ensure different variants use different stacks BOPTrees tree = ((BOPTrees) state.getValue(this.variantProperty)); - return this.getMetaFromState(this.getDefaultState().withProperty(this.variantProperty, tree)); + ItemStack stack = BlockBOPSapling.paging.getVariantItem(tree); + return stack.getItemDamage(); } // TODO: different fruits for different trees?