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