From 33a6ec9a70ca018a266d1bffb10dc686a640b712 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Sep 2012 00:48:22 -0700 Subject: [PATCH] Made PlayerEvent.BreakSpeed fire when a player cannot harvest the block. Issues #191 and #188 --- common/net/minecraftforge/common/ForgeHooks.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/net/minecraftforge/common/ForgeHooks.java b/common/net/minecraftforge/common/ForgeHooks.java index a929b0383..791bb6b3a 100644 --- a/common/net/minecraftforge/common/ForgeHooks.java +++ b/common/net/minecraftforge/common/ForgeHooks.java @@ -10,6 +10,7 @@ import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import net.minecraft.src.*; +import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.living.*; import net.minecraftforge.event.entity.living.LivingEvent.*; @@ -112,7 +113,8 @@ public class ForgeHooks if (!canHarvestBlock(block, player, metadata)) { - return 1.0F / hardness / 100F; + float speed = ForgeEventFactory.getBreakSpeed(player, block, metadata, 1.0f); + return (speed < 0 ? 0 : speed) / hardness / 100F; } else {