/* * Copyright (C) 2012,2013 yogpstop * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the * GNU Lesser General Public License along with this program. * If not, see <http://www.gnu.org/licenses/>. */ package org.yogpstop.tof; import java.util.EnumSet; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.settings.KeyBinding; import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler; import cpw.mods.fml.common.TickType; public class KeyboardHandler extends KeyHandler { public KeyboardHandler(KeyBinding[] keyBindings, boolean[] repeatings) { super(keyBindings, repeatings); } @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { if (!(Minecraft.getMinecraft().currentScreen instanceof GuiOptions)) return; if (kb.keyCode == this.getKeyBindings()[0].keyCode) { Minecraft.getMinecraft().displayGuiScreen(new GuiSetting()); } } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {} @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.CLIENT); } @Override public String getLabel() { return "TimesOreForge"; } }