// Path: src/main/java/com/corwinjv/mobtotems/network/ActivateBaubleMessage.java
// public class ActivateBaubleMessage extends Message<ActivateBaubleMessage> {
//     @Override
//     protected void handleServer(ActivateBaubleMessage message, EntityPlayerMP player) {
//         final IBaublesItemHandler baublesItemHandler = BaublesApi.getBaublesHandler(player);
// 
//         if (baublesItemHandler == null) {
//             return;
//         }
// 
//         for (int i = 0; i < baublesItemHandler.getSlots(); i++) {
//             final ItemStack baubleStack = baublesItemHandler.getStackInSlot(i);
//             if (baubleStack != ItemStack.EMPTY
//                     && baubleStack.getItem() instanceof BaubleItem) {
//                 ((BaubleItem) baubleStack.getItem()).onBaubleActivated(baubleStack, player);
//             }
//         }
//     }
// }
// 
// Path: src/main/java/com/corwinjv/mobtotems/network/Network.java
// public class Network {
//     private static SimpleNetworkWrapper instance = null;
//     private static int DISCRIMINATOR_ID = 0;
// 
//     public static void init() {
//         instance = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MOD_ID);
// 
//         instance.registerMessage(ActivateBaubleMessage.class, ActivateBaubleMessage.class, getDiscriminatorId(), Side.SERVER);
//         instance.registerMessage(ActivateKnifeMessage.class, ActivateKnifeMessage.class, getDiscriminatorId(), Side.SERVER);
//         instance.registerMessage(SetKnifeMetaMessage.class, SetKnifeMetaMessage.class, getDiscriminatorId(), Side.SERVER);
// 
//         instance.registerMessage(OpenKnifeGuiMessage.class, OpenKnifeGuiMessage.class, getDiscriminatorId(), Side.CLIENT);
//     }
// 
//     private static int getDiscriminatorId() {
//         return DISCRIMINATOR_ID++;
//     }
// 
//     public static void sendToServer(Message message) {
//         instance.sendToServer(message);
//     }
// 
//     public static void sendToAll(Message message) {
//         instance.sendToAll(message);
//     }
// 
//     public static void sendTo(Message message, EntityPlayerMP player) {
//         instance.sendTo(message, player);
//     }
// }


import com.corwinjv.mobtotems.network.ActivateBaubleMessage;
import com.corwinjv.mobtotems.network.Network;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
package com.corwinjv.mobtotems;


/**
 * Created by CorwinJV on 1/31/2016.
 */
public class KeyBindings {

    public static final int ACTIVATE_BAUBLE_KEY = 0;

    public static final KeyBinding[] keys = new KeyBinding[1];

    public static boolean ACTIVATE_BAUBLE_KEY_PRESSED = false;

    public KeyBindings() {
        keys[ACTIVATE_BAUBLE_KEY] = new KeyBinding("key.mobtotems.activateBaubleDescription", Keyboard.KEY_H, "key.mobtotems.category");
        ClientRegistry.registerKeyBinding(keys[ACTIVATE_BAUBLE_KEY]);
    }

    @SubscribeEvent
    @SideOnly(Side.CLIENT)
    public void onKeyInput(InputEvent.KeyInputEvent event) {
        if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
            if (keys[ACTIVATE_BAUBLE_KEY].isKeyDown() && !ACTIVATE_BAUBLE_KEY_PRESSED) {
// Path: src/main/java/com/corwinjv/mobtotems/network/ActivateBaubleMessage.java
// public class ActivateBaubleMessage extends Message<ActivateBaubleMessage> {
//     @Override
//     protected void handleServer(ActivateBaubleMessage message, EntityPlayerMP player) {
//         final IBaublesItemHandler baublesItemHandler = BaublesApi.getBaublesHandler(player);
// 
//         if (baublesItemHandler == null) {
//             return;
//         }
// 
//         for (int i = 0; i < baublesItemHandler.getSlots(); i++) {
//             final ItemStack baubleStack = baublesItemHandler.getStackInSlot(i);
//             if (baubleStack != ItemStack.EMPTY
//                     && baubleStack.getItem() instanceof BaubleItem) {
//                 ((BaubleItem) baubleStack.getItem()).onBaubleActivated(baubleStack, player);
//             }
//         }
//     }
// }
// 
// Path: src/main/java/com/corwinjv/mobtotems/network/Network.java
// public class Network {
//     private static SimpleNetworkWrapper instance = null;
//     private static int DISCRIMINATOR_ID = 0;
// 
//     public static void init() {
//         instance = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MOD_ID);
// 
//         instance.registerMessage(ActivateBaubleMessage.class, ActivateBaubleMessage.class, getDiscriminatorId(), Side.SERVER);
//         instance.registerMessage(ActivateKnifeMessage.class, ActivateKnifeMessage.class, getDiscriminatorId(), Side.SERVER);
//         instance.registerMessage(SetKnifeMetaMessage.class, SetKnifeMetaMessage.class, getDiscriminatorId(), Side.SERVER);
// 
//         instance.registerMessage(OpenKnifeGuiMessage.class, OpenKnifeGuiMessage.class, getDiscriminatorId(), Side.CLIENT);
//     }
// 
//     private static int getDiscriminatorId() {
//         return DISCRIMINATOR_ID++;
//     }
// 
//     public static void sendToServer(Message message) {
//         instance.sendToServer(message);
//     }
// 
//     public static void sendToAll(Message message) {
//         instance.sendToAll(message);
//     }
// 
//     public static void sendTo(Message message, EntityPlayerMP player) {
//         instance.sendTo(message, player);
//     }
// }


// Path: src/main/java/com/corwinjv/mobtotems/KeyBindings.java
import com.corwinjv.mobtotems.network.ActivateBaubleMessage;
import com.corwinjv.mobtotems.network.Network;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;

package com.corwinjv.mobtotems;


/**
 * Created by CorwinJV on 1/31/2016.
 */
public class KeyBindings {

    public static final int ACTIVATE_BAUBLE_KEY = 0;

    public static final KeyBinding[] keys = new KeyBinding[1];

    public static boolean ACTIVATE_BAUBLE_KEY_PRESSED = false;

    public KeyBindings() {
        keys[ACTIVATE_BAUBLE_KEY] = new KeyBinding("key.mobtotems.activateBaubleDescription", Keyboard.KEY_H, "key.mobtotems.category");
        ClientRegistry.registerKeyBinding(keys[ACTIVATE_BAUBLE_KEY]);
    }

    @SubscribeEvent
    @SideOnly(Side.CLIENT)
    public void onKeyInput(InputEvent.KeyInputEvent event) {
        if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
            if (keys[ACTIVATE_BAUBLE_KEY].isKeyDown() && !ACTIVATE_BAUBLE_KEY_PRESSED) {
                Network.sendToServer(new ActivateBaubleMessage());