Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from GTNewHorizons/keybind
Browse files Browse the repository at this point in the history
unbind keybind and change keybind handler
  • Loading branch information
Connor-Colenso authored Feb 5, 2023
2 parents 3e8df70 + 877f569 commit 8bbc91c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/main/java/baubles/common/event/KeyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@

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.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class KeyHandler {

public KeyBinding key = new KeyBinding(
StatCollector.translateToLocal("keybind.baublesinventory"),
Keyboard.KEY_B,
Keyboard.KEY_NONE,
"key.categories.inventory");

public KeyHandler() {
Expand All @@ -28,12 +26,9 @@ public KeyHandler() {

@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 onKeyPressed(InputEvent.KeyInputEvent event) {
if (key.isPressed()) {
PacketHandler.INSTANCE.sendToServer(new PacketOpenBaublesInventory());
}
}
}

0 comments on commit 8bbc91c

Please sign in to comment.