From 2dbfe8b07715e4105cc70335518f5d2e14a3217d Mon Sep 17 00:00:00 2001 From: Abdulaziz Date: Mon, 13 Jan 2025 12:54:45 +0300 Subject: [PATCH 1/2] Fixed Crash --- .../java/com/cleanroommc/bogosorter/common/HotbarSwap.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java b/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java index 5c63a25..4cd4a56 100644 --- a/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java +++ b/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java @@ -48,7 +48,7 @@ public static boolean isEnabled() { @SubscribeEvent public void render(RenderGameOverlayEvent.Post event) { - if (enabled && event.type == RenderGameOverlayEvent.ElementType.ALL && show) { + if (enabled && Minecraft.getMinecraft().thePlayer.inventory.currentItem < 9 && event.type == RenderGameOverlayEvent.ElementType.ALL && show) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); EntityPlayer player = Minecraft.getMinecraft().thePlayer; @@ -95,7 +95,7 @@ public void render(RenderGameOverlayEvent.Post event) { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { - if (!enabled || Minecraft.getMinecraft().theWorld == null || Minecraft.getMinecraft().thePlayer == null) { + if (!enabled || Minecraft.getMinecraft().theWorld == null || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().thePlayer.inventory.currentItem > 8) { return; } if (show) { @@ -120,7 +120,7 @@ public void onKeyInput(InputEvent.KeyInputEvent event) { @SubscribeEvent public void onMouseInput(InputEvent.MouseInputEvent event) { - if (!enabled) return; + if (!enabled || Minecraft.getMinecraft().thePlayer.inventory.currentItem > 8) return; if (show) { int scroll = Mouse.getEventDWheel(); if (scroll != 0) { From 0f0ae2590c624beb3c9bbf6d5fbe8ce749e9d0a4 Mon Sep 17 00:00:00 2001 From: Abdulaziz Date: Mon, 13 Jan 2025 13:01:46 +0300 Subject: [PATCH 2/2] Spotless --- .../com/cleanroommc/bogosorter/common/HotbarSwap.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java b/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java index 4cd4a56..39719c2 100644 --- a/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java +++ b/src/main/java/com/cleanroommc/bogosorter/common/HotbarSwap.java @@ -48,7 +48,9 @@ public static boolean isEnabled() { @SubscribeEvent public void render(RenderGameOverlayEvent.Post event) { - if (enabled && Minecraft.getMinecraft().thePlayer.inventory.currentItem < 9 && event.type == RenderGameOverlayEvent.ElementType.ALL && show) { + if (enabled && Minecraft.getMinecraft().thePlayer.inventory.currentItem < 9 + && event.type == RenderGameOverlayEvent.ElementType.ALL + && show) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); EntityPlayer player = Minecraft.getMinecraft().thePlayer; @@ -95,7 +97,9 @@ public void render(RenderGameOverlayEvent.Post event) { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { - if (!enabled || Minecraft.getMinecraft().theWorld == null || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().thePlayer.inventory.currentItem > 8) { + if (!enabled || Minecraft.getMinecraft().theWorld == null + || Minecraft.getMinecraft().thePlayer == null + || Minecraft.getMinecraft().thePlayer.inventory.currentItem > 8) { return; } if (show) {