aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils')
-rw-r--r--src/main/kotlin/dulkirmod/utils/TitleUtils.kt36
-rw-r--r--src/main/kotlin/dulkirmod/utils/Utils.kt14
2 files changed, 49 insertions, 1 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/TitleUtils.kt b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
new file mode 100644
index 0000000..52fe793
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
@@ -0,0 +1,36 @@
+package dulkirmod.utils
+
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import net.minecraft.client.gui.ScaledResolution
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.math.min
+
+class TitleUtils {
+ var curString = ""
+ var endTime : Long = 0
+
+ @SubscribeEvent
+ fun onRender(event: RenderGameOverlayEvent.Text) {
+ if (System.currentTimeMillis() > endTime) return
+ val width = mc.fontRendererObj.getStringWidth(curString)
+ val screenWidth = ScaledResolution(mc).scaledWidth_double
+ val screenHeight = ScaledResolution(mc).scaledHeight_double
+ var scale = ((screenWidth - 100) * Config.bestiaryNotifSize) / width
+ scale = min(scale, 10.0)
+ GlStateManager.pushMatrix()
+ GlStateManager.translate((screenWidth / 2 - width * scale / 2), screenHeight/2 - (4.5 * scale), 0.0)
+ GlStateManager.scale(scale, scale, scale)
+ mc.fontRendererObj.drawString(curString, 0f, 0f, 0, Config.bestiaryTextShadow)
+ GlStateManager.popMatrix()
+ }
+
+ fun drawStringForTime(string : String, time : Int) {
+ this.curString = string
+ this.endTime = time.toLong() + System.currentTimeMillis()
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt
index c3caa26..95f714b 100644
--- a/src/main/kotlin/dulkirmod/utils/Utils.kt
+++ b/src/main/kotlin/dulkirmod/utils/Utils.kt
@@ -9,7 +9,6 @@ import java.awt.Toolkit
import java.awt.datatransfer.Clipboard
import java.awt.datatransfer.DataFlavor
import java.awt.datatransfer.StringSelection
-import java.lang.IllegalArgumentException
import java.util.*
object Utils {
@@ -54,4 +53,17 @@ object Utils {
}
mc.displayGuiScreen(null)
}
+
+ fun isInSkyblock() : Boolean{
+ if ((mc.theWorld != null) && (mc.thePlayer != null)) {
+ if (mc.isSingleplayer || mc.thePlayer.clientBrand == null ||
+ !mc.thePlayer.clientBrand.lowercase(Locale.getDefault()).contains("hypixel")) {
+ return false
+ }
+ if (mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1) == null)
+ return false;
+ return stripColorCodes(mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1).displayName).contains("SKYBLOCK")
+ }
+ return false
+ }
} \ No newline at end of file