aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt56
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt7
9 files changed, 68 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
index 054e5e19f..36263195d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
@@ -27,6 +27,7 @@ object ColorUtils {
max((red * factor).toInt(), 0),
max((green * factor).toInt(), 0),
max((blue * factor).toInt(), 0),
- alpha)
+ alpha
+ )
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
index af893d7dc..41bed3290 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
@@ -302,7 +302,16 @@ object GuiRenderUtils {
}
// Taken and edited from NEU <- it's broken
- fun renderTexturedBar(x: Float, y: Float, xSize: Float, completed: Float, color: Color, useChroma: Boolean, texture: SkillProgressBarConfig.TexturedBar.UsedTexture, height: Float) {
+ fun renderTexturedBar(
+ x: Float,
+ y: Float,
+ xSize: Float,
+ completed: Float,
+ color: Color,
+ useChroma: Boolean,
+ texture: SkillProgressBarConfig.TexturedBar.UsedTexture,
+ height: Float
+ ) {
GlStateManager.pushMatrix()
GlStateManager.translate(x, y, 0f)
val w = xSize.toInt()
@@ -316,13 +325,28 @@ object GuiRenderUtils {
if (useChroma) {
ChromaShaderManager.begin(ChromaType.TEXTURED)
- GlStateManager.color(Color.LIGHT_GRAY.darker().red / 255f, Color.LIGHT_GRAY.darker().green / 255f, Color.LIGHT_GRAY.darker().blue / 255f, 1f)
+ GlStateManager.color(
+ Color.LIGHT_GRAY.darker().red / 255f,
+ Color.LIGHT_GRAY.darker().green / 255f,
+ Color.LIGHT_GRAY.darker().blue / 255f,
+ 1f
+ )
} else {
GlStateManager.color(color.darker().red / 255f, color.darker().green / 255f, color.darker().blue / 255f, 1f)
}
Utils.drawTexturedRect(x, y, w_2.toFloat(), height, 0f, w_2 / xSize, vMinEmpty, vMaxEmpty, GL11.GL_NEAREST)
- Utils.drawTexturedRect(x + w_2, y, w_2.toFloat(), height, 1 - w_2 / xSize, 1f, vMinEmpty, vMaxEmpty, GL11.GL_NEAREST)
+ Utils.drawTexturedRect(
+ x + w_2,
+ y,
+ w_2.toFloat(),
+ height,
+ 1 - w_2 / xSize,
+ 1f,
+ vMinEmpty,
+ vMaxEmpty,
+ GL11.GL_NEAREST
+ )
if (useChroma) {
GlStateManager.color(Color.WHITE.red / 255f, Color.WHITE.green / 255f, Color.WHITE.blue / 255f, 1f)
@@ -330,10 +354,30 @@ object GuiRenderUtils {
GlStateManager.color(color.red / 255f, color.green / 255f, color.blue / 255f, 1f)
}
- if (k > 0) {
- Utils.drawTexturedRect(x, y, w_2.coerceAtMost(k).toFloat(), height, 0f, w_2.toDouble().coerceAtMost(k.toDouble() / xSize).toFloat(), vMinFilled, vMaxFilled, GL11.GL_NEAREST)
+ if (k > 0) {
+ Utils.drawTexturedRect(
+ x,
+ y,
+ w_2.coerceAtMost(k).toFloat(),
+ height,
+ 0f,
+ w_2.toDouble().coerceAtMost(k.toDouble() / xSize).toFloat(),
+ vMinFilled,
+ vMaxFilled,
+ GL11.GL_NEAREST
+ )
if (completed > 0.5f) {
- Utils.drawTexturedRect(x + w_2, y, (k - w_2).toFloat(), height, 1 - w_2 / xSize, 1 + (k - w) / xSize, vMinFilled, vMaxFilled, GL11.GL_NEAREST)
+ Utils.drawTexturedRect(
+ x + w_2,
+ y,
+ (k - w_2).toFloat(),
+ height,
+ 1 - w_2 / xSize,
+ 1 + (k - w) / xSize,
+ vMinFilled,
+ vMaxFilled,
+ GL11.GL_NEAREST
+ )
}
}
if (useChroma) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt
index baf9ee8ea..3a3bc9397 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt
@@ -16,7 +16,7 @@ object ItemNameResolver {
}
if (itemName == "§cmissing repo item") {
- return itemNameCache.getOrPut(lowercase) { NEUInternalName.MISSING_ITEM }
+ return itemNameCache.getOrPut(lowercase) { NEUInternalName.MISSING_ITEM }
}
resolveEnchantmentByName(itemName)?.let {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 29700e684..60a466b98 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -27,14 +27,12 @@ import net.minecraft.entity.SharedMonsterAttributes
import net.minecraft.launchwrapper.Launch
import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.FMLCommonHandler
-import java.io.Serializable
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.Timer
import java.util.TimerTask
import java.util.regex.Matcher
import kotlin.time.Duration
-import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
object LorenzUtils {
@@ -144,7 +142,7 @@ object LorenzUtils {
fun getSBMonthByName(month: String): Int {
var monthNr = 0
- for (i in 1 .. 12) {
+ for (i in 1..12) {
val monthName = SkyBlockTime.monthName(i)
if (month == monthName) {
monthNr = i
@@ -372,5 +370,5 @@ object LorenzUtils {
fun sendMessageToServer(message: String) = ChatUtils.sendMessageToServer(message)
fun inMiningIsland() = IslandType.GOLD_MINES.isInIsland() || IslandType.DEEP_CAVERNS.isInIsland()
- || IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland()
+ || IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 6b25d2992..32ea32329 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -544,7 +544,7 @@ object RenderUtils {
val z: Double =
entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks - renderManager.viewerPosZ
val pix2 = Math.PI * 2.0
- for (i in 0 .. 90) {
+ for (i in 0..90) {
color.bindColor()
worldRenderer.pos(x + rad * cos(i * pix2 / 45.0), y + il, z + rad * sin(i * pix2 / 45.0)).endVertex()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 404a3a258..6ca2dd629 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -92,7 +92,7 @@ object SkyBlockItemModifierUtils {
@Suppress("CAST_NEVER_SUCCEEDS")
inline val ItemStack.cachedData get() = (this as ItemStackCachedData).skyhanni_cachedData
- fun ItemStack.getPetLevel(): Int = PetAPI.getPetLevel(displayName)?: 0
+ fun ItemStack.getPetLevel(): Int = PetAPI.getPetLevel(displayName) ?: 0
fun ItemStack.getMaxPetLevel() = if (this.getInternalName() == "GOLDEN_DRAGON;4".asInternalName()) 200 else 100
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt
index 645471087..9398d0e53 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt
@@ -5,12 +5,12 @@ import at.hannibal2.skyhanni.features.chroma.TexturedChromaShader
import at.hannibal2.skyhanni.features.misc.RoundedRectangleShader
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
-import java.io.BufferedReader
-import java.io.InputStreamReader
import net.minecraft.client.Minecraft
import net.minecraft.util.ResourceLocation
import org.apache.commons.lang3.StringUtils
import org.lwjgl.opengl.OpenGLException
+import java.io.BufferedReader
+import java.io.InputStreamReader
/**
* Object to handle shaders for SkyHanni
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt
index 496d9c46c..78f9ef569 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt
@@ -37,14 +37,17 @@ class Uniform<T>(
UniformType.FLOAT -> {
ShaderHelper.glUniform1f(uniformID, (newUniformValue as Float))
}
+
UniformType.VEC2 -> {
val values = newUniformValue as FloatArray
ShaderHelper.glUniform2f(uniformID, values[0], values[1])
}
+
UniformType.VEC3 -> {
val values = newUniformValue as FloatArray
ShaderHelper.glUniform3f(uniformID, values[0], values[1], values[2])
}
+
UniformType.BOOL -> ShaderHelper.glUniform1f(uniformID, if (newUniformValue as Boolean) 1f else 0f)
}
previousUniformValue = newUniformValue
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
index e2e7b5ae2..535298543 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -148,7 +148,12 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
lists.addAsSingletonList(renderable)
}
if (hiddenItemTexts.size > 0) {
- lists.addAsSingletonList(Renderable.hoverTips(" §7${hiddenItemTexts.size} cheap items are hidden.", hiddenItemTexts))
+ lists.addAsSingletonList(
+ Renderable.hoverTips(
+ " §7${hiddenItemTexts.size} cheap items are hidden.",
+ hiddenItemTexts
+ )
+ )
}
return profit