aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/About.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt12
7 files changed, 26 insertions, 16 deletions
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 86e4f790f..46afcc416 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
@@ -23,7 +23,7 @@ import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX
import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY
import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize
import at.hannibal2.skyhanni.utils.LorenzUtils
-import io.github.moulberry.notenoughupdates.util.Utils
+import at.hannibal2.skyhanni.utils.RenderUtils
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.ScaledResolution
@@ -52,7 +52,7 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde
}
private fun renderLabels(hoveredPos: Int) {
- Utils.drawStringCentered(
+ RenderUtils.drawStringCentered(
"§cSkyHanni Position Editor",
Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 8f, true, 0xffffff
)
@@ -70,12 +70,12 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde
if (displayPos == -1) return
val pos = positions[displayPos]
- Utils.drawStringCentered(
+ RenderUtils.drawStringCentered(
"§b" + pos.internalName,
Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 18f, true, 0xffffff
)
val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}"
- Utils.drawStringCentered(
+ RenderUtils.drawStringCentered(
location,
Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 28f, true, 0xffffff
)
@@ -191,7 +191,6 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde
val elementHeight = position.getDummySize(true).y
grabbedX += position.moveX(mouseX - grabbedX, elementWidth)
grabbedY += position.moveY(mouseY - grabbedY, elementHeight)
- Utils.pushGuiScale(-1)
}
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/About.java b/src/main/java/at/hannibal2/skyhanni/config/features/About.java
index cf7ec6b92..c67e2f7ee 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/About.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/About.java
@@ -1,10 +1,10 @@
package at.hannibal2.skyhanni.config.features;
import at.hannibal2.skyhanni.features.misc.update.ConfigVersionDisplay;
+import at.hannibal2.skyhanni.utils.OSUtils;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.*;
import io.github.moulberry.moulconfig.observer.Property;
-import io.github.moulberry.notenoughupdates.util.Utils;
public class About {
@@ -55,23 +55,23 @@ public class About {
@ConfigOption(name = "MoulConfig", desc = "MoulConfig is available under the LGPL 3.0 License or later version")
@ConfigEditorButton(buttonText = "Source")
- public Runnable moulConfig = () -> Utils.openUrl("https://github.com/NotEnoughUpdates/MoulConfig");
+ public Runnable moulConfig = () -> OSUtils.openBrowser("https://github.com/NotEnoughUpdates/MoulConfig");
@ConfigOption(name = "NotEnoughUpdates", desc = "NotEnoughUpdates is available under the LGPL 3.0 License or later version")
@ConfigEditorButton(buttonText = "Source")
- public Runnable notEnoughUpdates = () -> Utils.openUrl("https://github.com/NotEnoughUpdates/NotEnoughUpdates");
+ public Runnable notEnoughUpdates = () -> OSUtils.openBrowser("https://github.com/NotEnoughUpdates/NotEnoughUpdates");
@ConfigOption(name = "Forge", desc = "Forge is available under the LGPL 3.0 license")
@ConfigEditorButton(buttonText = "Source")
- public Runnable forge = () -> Utils.openUrl("https://github.com/MinecraftForge/MinecraftForge");
+ public Runnable forge = () -> OSUtils.openBrowser("https://github.com/MinecraftForge/MinecraftForge");
@ConfigOption(name = "LibAutoUpdate", desc = "LibAutoUpdate is available under the BSD 2 Clause License")
@ConfigEditorButton(buttonText = "Source")
- public Runnable libAutoUpdate = () -> Utils.openUrl("https://git.nea.moe/nea/libautoupdate/");
+ public Runnable libAutoUpdate = () -> OSUtils.openBrowser("https://git.nea.moe/nea/libautoupdate/");
@ConfigOption(name = "Mixin", desc = "Mixin is available under the MIT License")
@ConfigEditorButton(buttonText = "Source")
- public Runnable mixin = () -> Utils.openUrl("https://github.com/SpongePowered/Mixin/");
+ public Runnable mixin = () -> OSUtils.openBrowser("https://github.com/SpongePowered/Mixin/");
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
index b1c909f03..ef8a812e0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
@@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -29,7 +28,7 @@ class BazaarApi {
fun isBazaarItem(stack: ItemStack) = isBazaarItem(stack.getInternalName())
fun isBazaarItem(internalName: String): Boolean {
- return NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName) != null
+ return NEUItems.manager.auctionManager.getBazaarInfo(internalName) != null
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
index 7609d012f..28f78ec3b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
@@ -19,7 +19,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import kotlinx.coroutines.launch
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -298,7 +297,7 @@ class CropMoneyDisplay {
SkyHanniMod.coroutineScope.launch {
val map = mutableMapOf<String, Int>()
- for ((internalName, _) in NotEnoughUpdates.INSTANCE.manager.itemInformation) {
+ for ((internalName, _) in NEUItems.manager.itemInformation) {
if (!BazaarApi.isBazaarItem(internalName)) continue
if (internalName == "ENCHANTED_PAPER") continue
if (internalName == "ENCHANTED_BREAD") continue
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index b34462e3e..721547ef4 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
object NEUItems {
- private val manager: NEUManager get() = NotEnoughUpdates.INSTANCE.manager
+ val manager: NEUManager get() = NotEnoughUpdates.INSTANCE.manager
private val itemCache = mutableMapOf<String, ItemStack>()
private val itemNameCache = mutableMapOf<String, String>() // item name -> internal name
private val multiplierCache = mutableMapOf<String, Pair<String, Int>>()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
index 5089b4d82..050937022 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
@@ -12,6 +12,7 @@ import java.net.URI
object OSUtils {
+ @JvmStatic
fun openBrowser(url: String) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index df5567415..bab653f68 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -790,4 +790,16 @@ object RenderUtils {
GlStateManager.disableLighting()
GlStateManager.enableDepth()
}
+
+ /**
+ * Taken from NotEnoughUpdates
+ */
+ fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, colour: Int) {
+ val strLen = fr.getStringWidth(str)
+ val x2 = x - strLen / 2f
+ val y2 = y - fr.FONT_HEIGHT / 2f
+ GL11.glTranslatef(x2, y2, 0f)
+ fr.drawString(str, 0f, 0f, colour, shadow)
+ GL11.glTranslatef(-x2, -y2, 0f)
+ }
} \ No newline at end of file