mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-11-25 14:24:42 +00:00
unbind keybind by default (#9)
This commit is contained in:
1 parent
ea2485b2ed
commit
eca345b747
1 file changed
+8
-16
@@ -1,36 +1,28 @@
|
||||
package baubles.common.event;
|
||||
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import baubles.common.network.PacketHandler;
|
||||
import baubles.common.network.PacketOpenBaublesInventory;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class KeyHandler {
|
||||
|
||||
public KeyBinding key = new KeyBinding(StatCollector.translateToLocal("keybind.baublesinventory"),
|
||||
Keyboard.KEY_B, "key.categories.inventory");
|
||||
|
||||
|
||||
public KeyBinding key = new KeyBinding(StatCollector.translateToLocal("keybind.baublesinventory"),
|
||||
Keyboard.KEY_NONE, "key.categories.inventory");
|
||||
|
||||
public KeyHandler() {
|
||||
ClientRegistry.registerKeyBinding(key);
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void playerTick(PlayerTickEvent event) {
|
||||
if (event.side == Side.SERVER) return;
|
||||
if (event.phase == Phase.START ) {
|
||||
if (key.getIsKeyPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenBaublesInventory(event.player));
|
||||
}
|
||||
public void onKeyEvent(InputEvent.KeyInputEvent event) {
|
||||
if (key.getIsKeyPressed()) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenBaublesInventory());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user