aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiOptionEditorDraggableList.java19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiPositionEditor.java21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/gui/core/util/GuiElementSlider.java21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/gui/utils/ConfigUtils.java (renamed from src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java)8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt6
7 files changed, 43 insertions, 40 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiOptionEditorDraggableList.java
index dccab640a..ba72f34b9 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiOptionEditorDraggableList.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiOptionEditorDraggableList.java
@@ -1,15 +1,10 @@
package at.hannibal2.skyhanni.config.gui.core.config.gui;
-import static at.hannibal2.skyhanni.config.gui.GuiTextures.DELETE;
-import static at.hannibal2.skyhanni.config.gui.GuiTextures.button_tex;
-
import at.hannibal2.skyhanni.config.gui.core.config.struct.ConfigProcessor;
import at.hannibal2.skyhanni.config.gui.core.util.lerp.LerpUtils;
import at.hannibal2.skyhanni.config.gui.core.util.render.RenderUtils;
import at.hannibal2.skyhanni.config.gui.core.util.render.TextRenderUtils;
-import at.hannibal2.skyhanni.config.gui.utils.Utils;
-import java.util.ArrayList;
-import java.util.List;
+import at.hannibal2.skyhanni.config.gui.utils.ConfigUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
@@ -19,6 +14,12 @@ import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
+import java.util.ArrayList;
+import java.util.List;
+
+import static at.hannibal2.skyhanni.config.gui.GuiTextures.DELETE;
+import static at.hannibal2.skyhanni.config.gui.GuiTextures.button_tex;
+
public class GuiOptionEditorDraggableList extends GuiOptionEditor {
private final String[] exampleText;
@@ -72,7 +73,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
GlStateManager.color(1, greenBlue, greenBlue, 1);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(DELETE);
- Utils.drawTexturedRect(x + width / 6 + 27, y + 45 - 7 - 13, 11, 14, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(x + width / 6 + 27, y + 45 - 7 - 13, 11, 14, GL11.GL_NEAREST);
Gui.drawRect(x + 5, y + 45, x + width - 5, y + height - 5, 0xffdddddd);
Gui.drawRect(x + 6, y + 46, x + width - 6, y + height - 6, 0xff000000);
@@ -89,7 +90,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
if (i++ != dragStartIndex) {
for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) {
String line = multilines[multilineIndex];
- Utils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, x + 20, y + 50 + yOff + multilineIndex * 10, true, width - 20, 0xffffffff);
+ ConfigUtils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, x + 20, y + 50 + yOff + multilineIndex * 10, true, width - 20, 0xffffffff);
}
Minecraft.getMinecraft().fontRendererObj.drawString("\u2261", x + 10, y + 50 + yOff + ySize / 2 - 4, 0xffffff, true);
}
@@ -157,7 +158,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
GlStateManager.enableBlend();
for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) {
String line = multilines[multilineIndex];
- Utils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, dragOffsetX + mouseX + 10, dragOffsetY + mouseY + multilineIndex * 10, true, width - 20, 0xffffff | (opacity << 24));
+ ConfigUtils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, dragOffsetX + mouseX + 10, dragOffsetY + mouseY + multilineIndex * 10, true, width - 20, 0xffffff | (opacity << 24));
}
int ySize = multilines.length * 10;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiPositionEditor.java b/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiPositionEditor.java
index 087fab743..efb04043f 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiPositionEditor.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/gui/core/config/gui/GuiPositionEditor.java
@@ -1,8 +1,7 @@
package at.hannibal2.skyhanni.config.gui.core.config.gui;
import at.hannibal2.skyhanni.config.gui.core.config.Position;
-import at.hannibal2.skyhanni.config.gui.utils.Utils;
-import java.io.IOException;
+import at.hannibal2.skyhanni.config.gui.utils.ConfigUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
@@ -10,6 +9,8 @@ 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;
@@ -51,7 +52,7 @@ public class GuiPositionEditor extends GuiScreen {
super.drawScreen(mouseX, mouseY, partialTicks);
ScaledResolution scaledResolution;
if (guiScaleOverride >= 0) {
- scaledResolution = Utils.pushGuiScale(guiScaleOverride);
+ scaledResolution = ConfigUtils.pushGuiScale(guiScaleOverride);
} else {
scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
}
@@ -78,12 +79,12 @@ public class GuiPositionEditor extends GuiScreen {
Gui.drawRect(x, y, x + elementWidth, y + elementHeight, 0x80404040);
if (guiScaleOverride >= 0) {
- Utils.pushGuiScale(-1);
+ ConfigUtils.pushGuiScale(-1);
}
scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj, scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff);
- Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj, scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff);
+ ConfigUtils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj, scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff);
+ ConfigUtils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj, scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff);
}
@Override
@@ -93,7 +94,7 @@ public class GuiPositionEditor extends GuiScreen {
if (mouseButton == 0) {
ScaledResolution scaledResolution;
if (guiScaleOverride >= 0) {
- scaledResolution = Utils.pushGuiScale(guiScaleOverride);
+ scaledResolution = ConfigUtils.pushGuiScale(guiScaleOverride);
} else {
scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
}
@@ -112,7 +113,7 @@ public class GuiPositionEditor extends GuiScreen {
}
if (guiScaleOverride >= 0) {
- Utils.pushGuiScale(-1);
+ ConfigUtils.pushGuiScale(-1);
}
}
}
@@ -152,7 +153,7 @@ public class GuiPositionEditor extends GuiScreen {
if (clicked) {
ScaledResolution scaledResolution;
if (guiScaleOverride >= 0) {
- scaledResolution = Utils.pushGuiScale(guiScaleOverride);
+ scaledResolution = ConfigUtils.pushGuiScale(guiScaleOverride);
} else {
scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
}
@@ -164,7 +165,7 @@ public class GuiPositionEditor extends GuiScreen {
positionChangedCallback.run();
if (guiScaleOverride >= 0) {
- Utils.pushGuiScale(-1);
+ ConfigUtils.pushGuiScale(-1);
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/core/util/GuiElementSlider.java b/src/main/java/at/hannibal2/skyhanni/config/gui/core/util/GuiElementSlider.java
index b5bd6636c..d55c9ed23 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/gui/core/util/GuiElementSlider.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/gui/core/util/GuiElementSlider.java
@@ -1,16 +1,17 @@
package at.hannibal2.skyhanni.config.gui.core.util;
-import static at.hannibal2.skyhanni.config.gui.GuiTextures.*;
-
import at.hannibal2.skyhanni.config.gui.core.GuiElement;
-import at.hannibal2.skyhanni.config.gui.utils.Utils;
-import java.util.function.Consumer;
+import at.hannibal2.skyhanni.config.gui.utils.ConfigUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
+import java.util.function.Consumer;
+
+import static at.hannibal2.skyhanni.config.gui.GuiTextures.*;
+
public class GuiElementSlider extends GuiElement {
public int x;
@@ -61,28 +62,28 @@ public class GuiElementSlider extends GuiElement {
GlStateManager.color(1f, 1f, 1f, 1f);
Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_cap);
- Utils.drawTexturedRect(x, y, 4, HEIGHT, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(x, y, 4, HEIGHT, GL11.GL_NEAREST);
Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_cap);
- Utils.drawTexturedRect(x + width - 4, y, 4, HEIGHT, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(x + width - 4, y, 4, HEIGHT, GL11.GL_NEAREST);
if (sliderAmountI > 5) {
Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_segment);
- Utils.drawTexturedRect(x + 4, y, sliderAmountI - 4, HEIGHT, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(x + 4, y, sliderAmountI - 4, HEIGHT, GL11.GL_NEAREST);
}
if (sliderAmountI < width - 5) {
Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_segment);
- Utils.drawTexturedRect(x + sliderAmountI, y, width - 4 - sliderAmountI, HEIGHT, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(x + sliderAmountI, y, width - 4 - sliderAmountI, HEIGHT, GL11.GL_NEAREST);
}
for (int i = 1; i < 4; i++) {
int notchX = x + width * i / 4 - 1;
Minecraft.getMinecraft().getTextureManager().bindTexture(notchX > x + sliderAmountI ? slider_off_notch : slider_on_notch);
- Utils.drawTexturedRect(notchX, y + (HEIGHT - 4f) / 2, 2, 4, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(notchX, y + (HEIGHT - 4f) / 2, 2, 4, GL11.GL_NEAREST);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(slider_button_new);
- Utils.drawTexturedRect(x + sliderAmountI - 4, y, 8, HEIGHT, GL11.GL_NEAREST);
+ ConfigUtils.drawTexturedRect(x + sliderAmountI - 4, y, 8, HEIGHT, GL11.GL_NEAREST);
}
@Override
diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java b/src/main/java/at/hannibal2/skyhanni/config/gui/utils/ConfigUtils.java
index 51ffd0c8d..4d733b3da 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/gui/utils/ConfigUtils.java
@@ -18,8 +18,6 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
-import java.awt.*;
-import java.awt.datatransfer.StringSelection;
import java.math.RoundingMode;
import java.nio.FloatBuffer;
import java.text.DecimalFormat;
@@ -27,7 +25,7 @@ import java.text.DecimalFormatSymbols;
import java.util.LinkedList;
import java.util.Locale;
-public class Utils {
+public class ConfigUtils {
private static final LinkedList<Integer> guiScales = new LinkedList<>();
private static ScaledResolution lastScale = new ScaledResolution(Minecraft.getMinecraft());
@@ -313,8 +311,4 @@ public class Utils {
if (!stack.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("id")) return null;
return stack.getTagCompound().getCompoundTag("ExtraAttributes").getString("id");
}
- public static void copyToClipboard(String str) {
- Toolkit.getDefaultToolkit().getSystemClipboard()
- .setContents(new StringSelection(str), null);
- }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
index 854ab26eb..f00f73040 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -1,10 +1,10 @@
package at.hannibal2.skyhanni.test.command
-import at.hannibal2.skyhanni.config.gui.utils.Utils
import at.hannibal2.skyhanni.test.LorenzTest
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.OSUtils
import net.minecraft.client.Minecraft
object CopyItemCommand {
@@ -38,7 +38,7 @@ object CopyItemCommand {
}
val string = resultList.joinToString("\n")
- Utils.copyToClipboard(string)
+ OSUtils.copyToClipboard(string)
LorenzUtils.debug("item info printed!")
LorenzUtils.chat("§e[SkyHanni] item info copied into the clipboard!")
} catch (_: Throwable) {
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
index c5a05d94a..718c8adfc 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
@@ -1,11 +1,11 @@
package at.hannibal2.skyhanni.test.command
-import at.hannibal2.skyhanni.config.gui.utils.Utils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
+import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.entity.EntityLivingBase
@@ -95,7 +95,7 @@ object CopyNearbyEntitiesCommand {
if (counter != 0) {
val string = resultList.joinToString("\n")
- Utils.copyToClipboard(string)
+ OSUtils.copyToClipboard(string)
LorenzUtils.chat("§e[SkyHanni] $counter entities copied into the clipboard!")
} else {
LorenzUtils.chat("§e[SkyHanni] No entities found in a search radius of $searchRadius!")
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
index 5633e7f72..cb87ff2cd 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.utils
import java.awt.Desktop
+import java.awt.Toolkit
+import java.awt.datatransfer.StringSelection
import java.io.IOException
import java.net.URI
@@ -18,4 +20,8 @@ object OSUtils {
LorenzUtils.warning("[SkyHanni] Web browser is not supported!")
}
}
+
+ fun copyToClipboard(text: String) {
+ Toolkit.getDefaultToolkit().systemClipboard.setContents(StringSelection(text), null)
+ }
} \ No newline at end of file