summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/GuiPositionEditor.java139
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java60
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt381
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevData.java11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/GUI.java37
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java72
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Minions.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Misc.java45
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Summonings.java11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt114
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarUpdateTimer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/DicerRngDropCounter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityRenderer.java17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt69
-rw-r--r--src/main/resources/mixins.skyhanni.json1
54 files changed, 612 insertions, 532 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index b446a992f..0df857b26 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -120,6 +120,7 @@ public class SkyHanniMod {
loadModule(new GardenCropMilestones());
loadModule(new OwnInventoryData());
loadModule(new ToolTipData());
+ loadModule(new GuiEditManager());
// APIs
loadModule(new BazaarApi());
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index 8e3331b33..998d83718 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -1,13 +1,12 @@
package at.hannibal2.skyhanni.config;
-import at.hannibal2.skyhanni.SkyHanniMod;
import at.hannibal2.skyhanni.config.core.GuiElement;
import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper;
import at.hannibal2.skyhanni.config.core.config.Config;
import at.hannibal2.skyhanni.config.core.config.Position;
import at.hannibal2.skyhanni.config.core.config.annotations.Category;
-import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor;
import at.hannibal2.skyhanni.config.features.*;
+import at.hannibal2.skyhanni.data.GuiEditManager;
import at.hannibal2.skyhanni.features.misc.HideArmor;
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager;
import com.google.gson.annotations.Expose;
@@ -17,9 +16,9 @@ import org.lwjgl.input.Keyboard;
public class Features extends Config {
private void editOverlay(String activeConfig, int width, int height, Position position) {
- Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {
- }, () -> {
- }, () -> SkyHanniMod.screenToOpen = new GuiScreenElementWrapper(new ConfigEditor(SkyHanniMod.feature, activeConfig))));
+// Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {
+// }, () -> {
+// }, () -> SkyHanniMod.screenToOpen = new GuiScreenElementWrapper(new ConfigEditor(SkyHanniMod.feature, activeConfig))));
}
@Override
@@ -33,6 +32,11 @@ public class Features extends Config {
}
}
+ if (runnableId.equals("editGuiLocations")) {
+ GuiEditManager.openGuiEditor();
+ return;
+ }
+
if (runnableId.equals("petDisplay")) {
editOverlay(activeConfigCategory, 200, 16, misc.petDisplayPos);
return;
@@ -236,6 +240,10 @@ public class Features extends Config {
}
@Expose
+ @Category(name = "GUI Locations", desc = "Change the locations of GUI elements. (§e/sh gui§7)")
+ public GUI gui = new GUI();
+
+ @Expose
@Category(name = "Chat", desc = "Change how the chat looks.")
public Chat chat = new Chat();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index a279f1fc1..53ac4f37e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigEditor
import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnable
import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper
import at.hannibal2.skyhanni.data.ApiDataLoader
+import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay
import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper
import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper
@@ -22,8 +23,12 @@ object Commands {
private val openMainMenu: (Array<String>) -> Unit = {
if (it.isNotEmpty()) {
- SkyHanniMod.screenToOpen =
- GuiScreenElementWrapper(ConfigEditor(SkyHanniMod.feature, StringUtils.join(it, " ")))
+ if (it[0].lowercase() == "gui") {
+ GuiEditManager.openGuiEditor()
+ } else {
+ SkyHanniMod.screenToOpen =
+ GuiScreenElementWrapper(ConfigEditor(SkyHanniMod.feature, StringUtils.join(it, " ")))
+ }
} else {
SkyHanniMod.screenToOpen = GuiScreenElementWrapper(ConfigEditor(SkyHanniMod.feature))
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/GuiPositionEditor.java b/src/main/java/at/hannibal2/skyhanni/config/core/config/GuiPositionEditor.java
deleted file mode 100644
index abbb60646..000000000
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/GuiPositionEditor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package at.hannibal2.skyhanni.config.core.config;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
-
-import java.io.IOException;
-
-public class GuiPositionEditor extends GuiScreen {
- public PositionNew position = new PositionNew();
-
- public int clickedX;
- public int clickedY;
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawDefaultBackground();
-
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- int width = scaledResolution.getScaledWidth();
- int height = scaledResolution.getScaledHeight();
-
- int x = position.resolveX(scaledResolution, 200);
- int y = position.resolveY(scaledResolution, 100);
-
- int centerWidth = 176;
- int centerHeight = 166;
-
- float centerWF = centerWidth / 2f / (float) width;
- float centerHF = centerHeight / 2f / (float) height;
-
- float left = 0;
- float top = 0;
- float right = 0;
- float bottom = 0;
-
- switch (position.getAnchorX()) {
- case MIN: {
- left = 0;
- right = 0.5f - centerWF;
- break;
- }
- case MID: {
- left = 0.5f - centerWF;
- right = 0.5f + centerWF;
- break;
- }
- case MAX: {
- left = 0.5f + centerWF;
- right = 1;
- break;
- }
- }
- switch (position.getAnchorY()) {
- case MIN: {
- top = 0;
- bottom = 0.5f - centerHF;
- break;
- }
- case MID: {
- top = 0.5f - centerHF;
- bottom = 0.5f + centerHF;
- break;
- }
- case MAX: {
- top = 0.5f + centerHF;
- bottom = 1;
- break;
- }
- }
-
- Gui.drawRect(
- (int) (left * width),
- (int) (top * height),
- (int) (right * width),
- (int) (bottom * height),
- 0x40404040
- );
- Gui.drawRect(x, y, x + 200, y + 100, 0x80404040);
- }
-
- @Override
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- int x = position.resolveX(scaledResolution, 200);
- int y = position.resolveY(scaledResolution, 100);
-
- if (mouseX > x && mouseX < x + 200 &&
- mouseY > y && mouseY < y + 100) {
- clickedX = mouseX;
- clickedY = mouseY;
- } else {
- clickedX = -1;
- clickedY = -1;
- }
- }
-
- @Override
- protected void mouseReleased(int mouseX, int mouseY, int state) {
- clickedX = -1;
- clickedY = -1;
- }
-
- @Override
- protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
- if (clickedX >= 0 && clickedY >= 0) {
- int deltaX = mouseX - clickedX;
- int deltaY = mouseY - clickedY;
-
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
-
- deltaX = position.moveX(scaledResolution, deltaX, 200);
- deltaY = position.moveY(scaledResolution, deltaY, 100);
-
- clickedX += deltaX;
- clickedY += deltaY;
- }
- }
-}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java b/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java
index 91032ff1f..65bb35996 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java
@@ -32,6 +32,9 @@ public class Position {
@Expose
private boolean centerY;
+ private boolean clicked = false;
+ public String internalName = null;
+
private static final int EDGE_OFFSET = 0;
public Position(int x, int y) {
@@ -53,15 +56,17 @@ public class Position {
}
public Position clone() {
- return new Position(x, y, centerX, centerY);
+ Position position = new Position(x, y, centerX, centerY);
+ position.internalName = internalName;
+ return position;
}
- public boolean isCenterX() {
- return centerX;
- }
+// public boolean isCenterX() {
+// return ;
+// }
public boolean isCenterY() {
- return centerY;
+ return false;
}
public int getRawX() {
@@ -72,13 +77,16 @@ public class Position {
return y;
}
+ public void setClicked(boolean state) {
+ this.clicked = state;
+ }
+ public boolean getClicked() {
+ return clicked;
+ }
+
public int getAbsX(ScaledResolution scaledResolution, int objWidth) {
int width = scaledResolution.getScaledWidth();
- if (centerX) {
- return width / 2 + x;
- }
-
int ret = x;
if (x < 0) {
ret = width + x - objWidth;
@@ -93,10 +101,6 @@ public class Position {
public int getAbsY(ScaledResolution scaledResolution, int objHeight) {
int height = scaledResolution.getScaledHeight();
- if (centerY) {
- return height / 2 + y;
- }
-
int ret = y;
if (y < 0) {
ret = height + y - objHeight;
@@ -113,21 +117,6 @@ public class Position {
boolean wasPositiveX = this.x >= 0;
this.x += deltaX;
- if (centerX) {
- if (wasPositiveX) {
- if (this.x > screenWidth / 2 - objWidth / 2) {
- deltaX += screenWidth / 2 - objWidth / 2 - this.x;
- this.x = screenWidth / 2 - objWidth / 2;
- }
- } else {
- if (this.x < -screenWidth / 2 + objWidth / 2) {
- deltaX += -screenWidth / 2 + objWidth / 2 - this.x;
- this.x = -screenWidth / 2 + objWidth / 2;
- }
- }
- return deltaX;
- }
-
if (wasPositiveX) {
if (this.x < EDGE_OFFSET) {
deltaX += EDGE_OFFSET - this.x;
@@ -162,21 +151,6 @@ public class Position {
boolean wasPositiveY = this.y >= 0;
this.y += deltaY;
- if (centerY) {
- if (wasPositiveY) {
- if (this.y > screenHeight / 2 - objHeight / 2) {
- deltaY += screenHeight / 2 - objHeight / 2 - this.y;
- this.y = screenHeight / 2 - objHeight / 2;
- }
- } else {
- if (this.y < -screenHeight / 2 + objHeight / 2) {
- deltaY += -screenHeight / 2 + objHeight / 2 - this.y;
- this.y = -screenHeight / 2 + objHeight / 2;
- }
- }
- return deltaY;
- }
-
if (wasPositiveY) {
if (this.y < EDGE_OFFSET) {
deltaY += EDGE_OFFSET - this.y;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
index 1bb404599..d09fcbc25 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
@@ -16,183 +16,204 @@
* You should have received a copy of the GNU Lesser General Public License
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-
-package at.hannibal2.skyhanni.config.core.config.gui;
-
-import at.hannibal2.skyhanni.config.core.config.Position;
-import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-
-import java.io.IOException;
-
-public class GuiPositionEditor extends GuiScreen {
- private final Position position;
- private final Position originalPosition;
- private final int elementWidth;
- private final int elementHeight;
- private final Runnable renderCallback;
- private final Runnable positionChangedCallback;
- private final Runnable closedCallback;
- private boolean clicked = false;
- private int grabbedX = 0;
- private int grabbedY = 0;
-
-// private int guiScaleOverride = -1;
-
- public GuiPositionEditor(
- Position position, int elementWidth, int elementHeight,
- Runnable renderCallback,
- Runnable positionChangedCallback,
- Runnable closedCallback
- ) {
- this.position = position;
- this.originalPosition = position.clone();
- this.elementWidth = elementWidth;
- this.elementHeight = elementHeight;
- this.renderCallback = renderCallback;
- this.positionChangedCallback = positionChangedCallback;
- this.closedCallback = closedCallback;
- }
-
-// public GuiPositionEditor withScale(int scale) {
-// this.guiScaleOverride = scale;
-// return this;
-// }
-
- @Override
- public void onGuiClosed() {
- super.onGuiClosed();
- closedCallback.run();
- }
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
- ScaledResolution scaledResolution;
-// if (guiScaleOverride >= 0) {
-// scaledResolution = GuiRenderUtils.pushGuiScale(guiScaleOverride);
-// } else {
- scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
-// }
-
- this.width = scaledResolution.getScaledWidth();
- this.height = scaledResolution.getScaledHeight();
- mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
- mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
-
- drawDefaultBackground();
-
- if (clicked) {
- grabbedX += position.moveX(mouseX - grabbedX, elementWidth, scaledResolution);
- grabbedY += position.moveY(mouseY - grabbedY, elementHeight, scaledResolution);
- }
-
- renderCallback.run();
-
- int x = position.getAbsX(scaledResolution, elementWidth);
- int y = position.getAbsY(scaledResolution, elementHeight);
-
- if (position.isCenterX()) x -= elementWidth / 2;
- if (position.isCenterY()) y -= elementHeight / 2;
- Gui.drawRect(x, y, x + elementWidth, y + elementHeight, 0x80404040);
-
-// if (guiScaleOverride >= 0) {
-// Utils.pushGuiScale(-1);
-// }
-
- scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- TextRenderUtils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff
- );
- TextRenderUtils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff
- );
- }
-
- @Override
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
- super.mouseClicked(mouseX, mouseY, mouseButton);
-
- if (mouseButton == 0) {
- ScaledResolution scaledResolution;
-// if (guiScaleOverride >= 0) {
-// scaledResolution = Utils.pushGuiScale(guiScaleOverride);
-// } else {
- scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
-// }
- mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
- mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
-
- int x = position.getAbsX(scaledResolution, elementWidth);
- int y = position.getAbsY(scaledResolution, elementHeight);