Extract tool config keybind handling into method

This commit is contained in:
Wilhelm Schuster committed 2024-11-22 09:02:40 +01:00
1 parent 496112d24d
commit bacae705ad
1 file changed
+6 -2
@@ -39,7 +39,7 @@ public class KeyInputHandler {
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
handleToolConfigKey();
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null
&& Minecraft.getMinecraft().thePlayer.getItemInUse() == null) {
DraconicEvolution.network
@@ -83,7 +83,7 @@ public class KeyInputHandler {
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
handleToolConfigKey();
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
@@ -125,6 +125,10 @@ public class KeyInputHandler {
}
}
private void handleToolConfigKey() {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
}
private int previouseSlot(int i, int c) {
if (c > 0 && c < 8) return c + i;
if (c == 0 && i < 0) return 8;