(fix) crosshair settings

This commit is contained in:
kirillsaint 2024-01-20 21:02:58 +06:00
parent e6ab006b39
commit 4c14924eb3
3 changed files with 31 additions and 14 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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()) {