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/BlockUtils.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/Timer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt8
13 files changed, 23 insertions, 26 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
index 5a14cadf7..b37f9b885 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
@@ -40,7 +40,7 @@ object BlockUtils {
return false
}
- fun rayTrace(start: LorenzVec, direction: LorenzVec, distance: Double = 50.0): LorenzVec? {
+ private fun rayTrace(start: LorenzVec, direction: LorenzVec, distance: Double = 50.0): LorenzVec? {
val help = direction.normalize().multiply(distance)
val target = start.add(help)
val result = Minecraft.getMinecraft().theWorld.rayTraceBlocks(start.toVec3(), target.toVec3())
@@ -53,4 +53,4 @@ object BlockUtils {
Minecraft.getMinecraft().thePlayer.lookVec.toLorenzVec(),
duration
)
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
index 4ac55af01..611edc75b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent
import at.hannibal2.skyhanni.mixins.transformers.CustomRenderGlobal
-import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.test.command.ErrorManager.logErrorWithData
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.OpenGlHelper
@@ -339,7 +339,7 @@ object EntityOutlineRenderer {
}
}
- fun isCacheEmpty() = isXrayCacheEmpty() && isNoXrayCacheEmpty()
+ private fun isCacheEmpty() = isXrayCacheEmpty() && isNoXrayCacheEmpty()
private fun isXrayCacheEmpty() = entityRenderCache.xrayCache?.isEmpty() ?: true
private fun isNoXrayCacheEmpty() = entityRenderCache.noXrayCache?.isEmpty() ?: true
@@ -366,7 +366,7 @@ object EntityOutlineRenderer {
val renderGlobal = try {
mc.renderGlobal as CustomRenderGlobal
} catch (e: NoClassDefFoundError) {
- ErrorManager.logError(e, "Unable to enable entity outlines, the required mixin is not loaded")
+ logErrorWithData(e, "Unable to enable entity outlines, the required mixin is not loaded")
isMissingMixin = true
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
index 5e4a63452..7dfae5bac 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
@@ -16,7 +16,7 @@ import kotlin.math.roundToInt
*/
object GuiRenderUtils {
- fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, colour: Int) {
+ private 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
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index a1b7ed09f..b419b46f4 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -158,7 +158,7 @@ object ItemUtils {
}
// Taken from NEU
- fun createSkull(displayName: String, uuid: String, value: String, lore: Array<String>?): ItemStack {
+ private fun createSkull(displayName: String, uuid: String, value: String, lore: Array<String>?): ItemStack {
val render = ItemStack(Items.skull, 1, 3)
val tag = NBTTagCompound()
val skullOwner = NBTTagCompound()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
index 5078a492f..9b7e1afdb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
@@ -16,7 +16,7 @@ object KeyboardManager {
private var lastClickedMouseButton = -1
// A mac-only key, represents Windows key on windows (but different key code)
- fun isCommandKeyDown() = Keyboard.KEY_LMETA.isKeyHeld() || Keyboard.KEY_RMETA.isKeyHeld()
+ private fun isCommandKeyDown() = Keyboard.KEY_LMETA.isKeyHeld() || Keyboard.KEY_RMETA.isKeyHeld()
fun isControlKeyDown() = Keyboard.KEY_LCONTROL.isKeyHeld() || Keyboard.KEY_RCONTROL.isKeyHeld()
fun isShiftKeyDown() = Keyboard.KEY_LSHIFT.isKeyHeld() || Keyboard.KEY_RSHIFT.isKeyHeld()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
index fafb41c96..2079408f7 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
@@ -6,7 +6,7 @@ import net.minecraft.util.AxisAlignedBB
object LocationUtils {
- fun canSee(a: LorenzVec, b: LorenzVec): Boolean {
+ private fun canSee(a: LorenzVec, b: LorenzVec): Boolean {
return Minecraft.getMinecraft().theWorld.rayTraceBlocks(a.toVec3(), b.toVec3(), false, true, false) == null
}
@@ -28,7 +28,7 @@ object LocationUtils {
return vec.add(0.0, 0.0 + player.getEyeHeight(), 0.0)
}
- fun AxisAlignedBB.isVecInside(vec: LorenzVec) = isVecInside(vec.toVec3())
+ private fun AxisAlignedBB.isVecInside(vec: LorenzVec) = isVecInside(vec.toVec3())
fun AxisAlignedBB.isPlayerInside() = isVecInside(playerLocation())
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 90970a315..88678fdd0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -367,7 +367,7 @@ object LorenzUtils {
}
// MoulConfig is in Java, I don't want to downgrade this logic
- fun <T> onChange(vararg properties: Property<out T>, observer: Observer<T>) {
+ private fun <T> onChange(vararg properties: Property<out T>, observer: Observer<T>) {
for (property in properties) {
property.whenChanged { a, b -> observer.observeChange(a, b) }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index d03455ac9..41e5f4923 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -204,6 +204,6 @@ object NumberUtil {
}
val Int.milion get() = this * 1_000_000.0
- val Int.bilion get() = this * 1_000_000_000.0
+ private val Int.bilion get() = this * 1_000_000_000.0
val Double.milion get() = (this * 1_000_000.0).toLong()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 7e10b0351..869aeeb25 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -244,7 +244,7 @@ object RenderUtils {
/**
* @author Mojang
*/
- fun drawNametag(str: String, color: Color?) {
+ private fun drawNametag(str: String, color: Color?) {
val fontRenderer = Minecraft.getMinecraft().fontRendererObj
val f1 = 0.02666667f
GlStateManager.pushMatrix()
@@ -352,7 +352,7 @@ object RenderUtils {
return lastValue + (currentValue - lastValue) * multiplier
}
- fun Position.transform(): Pair<Int, Int> {
+ private fun Position.transform(): Pair<Int, Int> {
GlStateManager.translate(getAbsX().toFloat(), getAbsY().toFloat(), 0F)
GlStateManager.scale(effectiveScale, effectiveScale, 1F)
val x = ((Utils.getMouseX() - getAbsX()) / effectiveScale).toInt()
@@ -374,14 +374,11 @@ object RenderUtils {
val minecraft = Minecraft.getMinecraft()
val renderer = minecraft.renderManager.fontRenderer
- val x = offsetX
- val y = offsetY
-
- GlStateManager.translate(x + 1.0, y + 1.0, 0.0)
+ GlStateManager.translate(offsetX + 1.0, offsetY + 1.0, 0.0)
if (centered) {
val strLen: Int = renderer.getStringWidth(string)
- val x2 = x - strLen / 2f
+ val x2 = offsetX - strLen / 2f
GL11.glTranslatef(x2, 0f, 0f)
renderer.drawStringWithShadow(display, 0f, 0f, 0)
GL11.glTranslatef(-x2, 0f, 0f)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 9f65a71f1..b0533a142 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -254,7 +254,7 @@ object SkyBlockItemModifierUtils {
fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes")
- class GemstoneSlot(val type: GemstoneType, val quality: GemstoneQuality) {
+ class GemstoneSlot(val type: GemstoneType, private val quality: GemstoneQuality) {
fun getInternalName() = "${quality}_${type}_GEM".asInternalName()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
index dd114d8fd..12b2e4c64 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
@@ -61,7 +61,7 @@ object StringUtils {
return map.subMap(prefix, true, lastKey, false)
}
- fun nextLexicographicallyStringWithSameLength(input: String): String {
+ private fun nextLexicographicallyStringWithSameLength(input: String): String {
val lastCharPosition = input.length - 1
val inputWithoutLastChar = input.substring(0, lastCharPosition)
val lastChar = input[lastCharPosition]
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt b/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt
index 2a6d1f5ab..a03270c57 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt
@@ -24,7 +24,7 @@ class Timer(
val ended get() = !remaining.isPositive()
val remaining get() = duration - elapsed
- val elapsed get() = paused?.let { it - started } ?: started.passedSince()
+ private val elapsed get() = paused?.let { it - started } ?: started.passedSince()
fun pause() {
paused = SimpleTimeMark.now()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
index 552e1a069..aa63f3382 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
@@ -90,7 +90,7 @@ interface Renderable {
return clickable(hoverTips(text, tips, bypassChecks = bypassChecks), onClick, bypassChecks = bypassChecks)
}
- fun clickable(
+ private fun clickable(
render: Renderable,
onClick: () -> Unit,
button: Int = 0,
@@ -195,7 +195,7 @@ interface Renderable {
return result
}
- fun underlined(renderable: Renderable) = object : Renderable {
+ private fun underlined(renderable: Renderable) = object : Renderable {
override val width: Int
get() = renderable.width
override val height = 10
@@ -207,7 +207,7 @@ interface Renderable {
}
}
- fun hoverable(
+ private fun hoverable(
hovered: Renderable,
unhovered: Renderable,
bypassChecks: Boolean = false,
@@ -254,7 +254,7 @@ interface Renderable {
}
}
- fun placeholder(width: Int) = object : Renderable {
+ private fun placeholder(width: Int) = object : Renderable {
override val width: Int = width
override val height = 10