Made PlayerEvent.BreakSpeed fire when a player cannot harvest the block. Issues #191 and #188

This commit is contained in:
LexManos 2012-09-30 00:48:22 -07:00
parent 27d6841579
commit 33a6ec9a70

View file

@ -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
{