summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java
blob: d196a05756710a00328fadc13ba096b9704a2c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package darkknight.jewelrycraft.events;

import org.lwjgl.input.Keyboard;

import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.network.PacketKeyPressEvent;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.settings.KeyBinding;

public class KeyBindings {
	public static KeyBinding	render		= new KeyBinding(
			"Pretty Render", Keyboard.KEY_Z,
			Variables.MODNAME);
	public static KeyBinding	inventory	= new KeyBinding(
			"Jewelry Inventory", Keyboard.KEY_J,
			Variables.MODNAME);
	public static KeyBinding	curses		= new KeyBinding(
			"Curses Tab", Keyboard.KEY_C, Variables.MODNAME);

	/**
	 * 
	 */
	public KeyBindings() {
		ClientRegistry.registerKeyBinding(render);
		ClientRegistry.registerKeyBinding(inventory);
		ClientRegistry.registerKeyBinding(curses);
	}

	/**
	 * @param event
	 */
	@SubscribeEvent
	public void onKeyInput(InputEvent.KeyInputEvent event) {
		if (render.isPressed())
			JewelrycraftMod.fancyRender = !JewelrycraftMod.fancyRender;
		if (inventory.isPressed())
			JewelrycraftMod.netWrapper.sendToServer(
					new PacketKeyPressEvent(0));
		if (curses.isPressed())
			JewelrycraftMod.netWrapper.sendToServer(
					new PacketKeyPressEvent(1));
	}
}