From 158ae52dd8bb1ee326dd32f6c0ba4d5390f5763c Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Tue, 25 Nov 2014 21:43:29 +0100 Subject: [PATCH] Fix OreBerry bushes not returning correct amount on leftclick --- .../tconstruct/world/blocks/OreberryBush.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/tconstruct/world/blocks/OreberryBush.java b/src/main/java/tconstruct/world/blocks/OreberryBush.java index 0dc8a5cc..ce6cecfb 100644 --- a/src/main/java/tconstruct/world/blocks/OreberryBush.java +++ b/src/main/java/tconstruct/world/blocks/OreberryBush.java @@ -15,6 +15,7 @@ import net.minecraft.util.*; import net.minecraft.world.*; import net.minecraftforge.common.*; import net.minecraftforge.common.util.ForgeDirection; +import tconstruct.TConstruct; import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.AbilityHelper; import tconstruct.world.TinkerWorld; @@ -175,24 +176,18 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable @Override public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player) { - if (!world.isRemote) - { - int meta = world.getBlockMetadata(x, y, z); - if (meta >= 12) - { - world.setBlock(x, y, z, this, meta - 4, 3); - AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, 1, meta % 4 + itemMeat)); - } - } + harvest(world, x,y,z, player); } /* Right-click harvests berries */ @Override public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { - /*if (world.isRemote) - return false;*/ + return harvest(world, x,y,z, player); + } + public boolean harvest(World world, int x, int y, int z, EntityPlayer player) + { int meta = world.getBlockMetadata(x, y, z); if (meta >= 12) { @@ -201,7 +196,6 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable world.setBlock(x, y, z, this, meta - 4, 3); AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat)); - return true; } return false;