    001    package net.minecraftforge.event;
    002    import net.minecraft.src.*;
    003    import net.minecraftforge.common.MinecraftForge;
    004    import net.minecraftforge.event.entity.player.*;
    005    import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
    006
    007    public class ForgeEventFactory
    008    {
    009        public static boolean doPlayerHarvestCheck(EntityPlayer player, Block block, boolean success)
    010        {
    011            PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success);
    012            MinecraftForge.EVENT_BUS.post(event);
    013            return event.success;
    014        }
    015
    016        public static float getBreakSpeed(EntityPlayer player, Block block, int metadata, float original)
    017        {
    018            PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, block, metadata, original);
    019            return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.newSpeed);
    020        }
    021
    022        public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, int x, int y, int z, int face)
    023        {
    024            PlayerInteractEvent event = new PlayerInteractEvent(player, action, x, y, z, face);
    025            MinecraftForge.EVENT_BUS.post(event);
    026            return event;
    027        }
    028
    029        public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack)
    030        {
    031            MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack));
    032        }
    033    }