From 3cdf9d9721713ad99865cd9ce5f742bc23b62838 Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Mon, 6 Apr 2015 20:19:19 +0100 Subject: [PATCH] Fix BOP leaves dropping too much fruit --- .../common/block/BlockBOPLeaves.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java index 9b807604d..15696a83f 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java @@ -153,14 +153,17 @@ public abstract class BlockBOPLeaves extends BlockLeaves implements IBOPBlock } // TODO: different fruits for different trees? - // TODO: fruit seems to be falling too often @Override protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) { + // chance will initially be related to fortune as follows: 0 => 200, 1 => 180, 2 => 160, 3 => 120, 4+ => 40 + ItemStack fruit = null; + AllTrees tree = ((AllTrees) state.getValue(getMyVariantProperty())); - ItemStack fruit; switch (tree) { + case RED_BIG_FLOWER: case YELLOW_BIG_FLOWER: + break; case YELLOW_AUTUMN: case ORANGE_AUTUMN: case BAMBOO: @@ -183,11 +186,14 @@ public abstract class BlockBOPLeaves extends BlockLeaves implements IBOPBlock case WILLOW: case PINE: case MAHOGANY: - case RED_BIG_FLOWER: - case YELLOW_BIG_FLOWER: default: - fruit = new ItemStack(Items.apple, 1, 0); - } + if (worldIn.rand.nextInt(chance) == 0) + { + fruit = new ItemStack(Items.apple, 1, 0); + } + break; + } + if (fruit != null) { spawnAsEntity(worldIn, pos, fruit); }