package invtweaks.forge;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import invtweaks.api.IItemTreeListener;
import invtweaks.api.InvTweaksAPI;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;

import java.util.LinkedHashMap;

/**
 * ModLoader entry point to load and configure the mod.
 *
 * @author Jimeo Wan
 *         <p/>
 *         Contact: jimeo.wan (at) gmail (dot) com Website: <a href="https://inventory-tweaks.readthedocs.org/">https://inventory-tweaks.readthedocs.org/</a>
 *         Source code: <a href="https://github.com/kobata/inventory-tweaks">GitHub</a> License: MIT
 */
@Mod(modid = "inventorytweaks",
     dependencies = "required-after:FML@[5.0.0,);required-after:Forge@[7.7.0,)")
@NetworkMod(channels = {"InventoryTweaks"}, packetHandler = PacketHandler.class,
            connectionHandler = ConnectionHandler.class)
public class InvTweaksMod implements InvTweaksAPI {
    @Mod.Instance
    public static InvTweaksMod instance;

    @SidedProxy(clientSide = "invtweaks.forge.ClientProxy", serverSide = "invtweaks.forge.CommonProxy")
    public static CommonProxy proxy;

    @Mod.PreInit
    public void preInit(FMLPreInitializationEvent e) {
        proxy.preInit(e);
    }

    @Mod.Init
    public void init(FMLInitializationEvent e) {
        proxy.init(e);
    }

    @Mod.PostInit
    public void postInit(FMLPostInitializationEvent e) {
        proxy.postInit(e);
    }

    @Override
    public void addOnLoadListener(IItemTreeListener listener) {
        proxy.addOnLoadListener(listener);
    }

    @Override
    public boolean removeOnLoadListener(IItemTreeListener listener) {
        return proxy.removeOnLoadListener(listener);
    }

    @Override
    public void setSortKeyEnabled(boolean enabled) {
        proxy.setSortKeyEnabled(enabled);
    }

    @Override
    public void setTextboxMode(boolean enabled) {
        proxy.setTextboxMode(enabled);
    }

    @Override
    public int compareItems(ItemStack i, ItemStack j) {
        return 0;  //To change body of implemented methods use File | Settings | File Templates.
    }

    // Helper for ASM transform of GuiTextField to disable sorting on focus.
    public static void setTextboxModeStatic(boolean enabled) {
        instance.setTextboxMode(enabled);
    }
}

@@ -1372,23 +1372,28 @@
    @Mod.
-PreInit
+EventHandler
 %0A    pub
@@ -1482,20 +1482,28 @@
    @Mod.
-Init
+EventHandler
 %0A    pub
@@ -1583,24 +1583,28 @@
    @Mod.
-PostInit
+EventHandler
 %0A    pub

Use @Mod.EventHandler instead of individual event annotations.