From 4c14924eb38ec5b1f4f05ebc67e2ea1e541c6c71 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 20 Jan 2024 21:02:58 +0600 Subject: [PATCH] (fix) crosshair settings --- .../client/gui/lite/clickgui/ModSettings.java | 6 +++- .../client/gui/modmenu/CellGrid.java | 33 ++++++++++++------- .../client/gui/modmenu/ModSettings.java | 6 +++- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java index 9bf847a..34a195f 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java @@ -200,7 +200,10 @@ public class ModSettings extends SilentScreen { } } if(setting.isCellGrid()) { - CellGrid.render(mouseX, mouseY, x + 100, settingY, setting); + MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, x + 100, settingY, setting); + if(cellGridCursor != null) { + cursorType = cellGridCursor; + } settingY += 135; } if (setting.isSlider()) { @@ -361,6 +364,7 @@ public class ModSettings extends SilentScreen { } if(setting.isCellGrid()) { CellGrid.click(mouseX, mouseY, mouseButton, setting); + settingY += 135; } if(setting.isCombo()) { int index = 0; diff --git a/src/main/java/net/silentclient/client/gui/modmenu/CellGrid.java b/src/main/java/net/silentclient/client/gui/modmenu/CellGrid.java index ac0b81a..f833f89 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/CellGrid.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/CellGrid.java @@ -7,6 +7,7 @@ import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.Setting; +import net.silentclient.client.utils.MouseCursorHandler; import java.awt.*; @@ -19,7 +20,8 @@ public class CellGrid { private static boolean rmb; private static boolean lmb; - public static void render(float mouseX, float mouseY, float x, float y, Setting grid) { + public static MouseCursorHandler.CursorType render(float mouseX, float mouseY, float x, float y, Setting grid) { + MouseCursorHandler.CursorType cursorType = null; for (int row = 0; row < 11; row++) { for (int col = 0; col < 11; col++) { float rx = x + col * 11; @@ -32,20 +34,27 @@ public class CellGrid { MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) ? 0x20ffffff : 0x00ffffff ); - if(MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) && rmb) { - grid.getCells()[row][col] = true; + if(MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + if(rmb) { + grid.getCells()[row][col] = true; + } + if(lmb) { + grid.getCells()[row][col] = false; + } } - - if(MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) && lmb) { - grid.getCells()[row][col] = false; - } - - trashBtn.xPosition = (int)x; - trashBtn.yPosition = (int)y + 125; - - trashBtn.drawButton(Minecraft.getMinecraft(), (int)mouseX, (int)mouseY); } } + + trashBtn.xPosition = (int)x; + trashBtn.yPosition = (int)y + 125; + + trashBtn.drawButton(Minecraft.getMinecraft(), (int)mouseX, (int)mouseY); + if(trashBtn.isMouseOver()) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } + + return cursorType; } public static void click(float mouseX, float mouseY, int btn, Setting setting) { diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java index 050c236..ee20e1a 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java @@ -136,7 +136,10 @@ public class ModSettings extends SilentScreen { } } if(setting.isCellGrid()) { - CellGrid.render(mouseX, mouseY, 3, settingY, setting); + MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, 3, settingY, setting); + if(cellGridCursor != null) { + cursorType = cellGridCursor; + } settingY += 135; } if(setting.isSlider()) { @@ -269,6 +272,7 @@ public class ModSettings extends SilentScreen { if(setting.isCellGrid()) { CellGrid.click(mouseX, mouseY, mouseButton, setting); + settingY += 135; } if(setting.isSlider()) {