aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-22 13:11:48 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-22 13:11:48 +0100
commita6de55740355b3bc4d7c869626d22da5b3854416 (patch)
treefe28873ec430dc4be8beedd9c2738aaf2a1943b7 /src/main/java
parent5c9cbdba458638ae962ccf92e750ebdcea718478 (diff)
downloadskyhanni-a6de55740355b3bc4d7c869626d22da5b3854416.tar.gz
skyhanni-a6de55740355b3bc4d7c869626d22da5b3854416.tar.bz2
skyhanni-a6de55740355b3bc4d7c869626d22da5b3854416.zip
reverted some private functions and other misc cleanup changes
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/IslandType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt4
-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.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt4
-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.kt10
17 files changed, 36 insertions, 28 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
index 17755da88..3ab213025 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
@@ -31,6 +31,6 @@ enum class IslandType(val displayName: String, val apiName: String = "null") {
fun getByNameOrUnknown(name: String) = getByNameOrNull(name) ?: UNKNOWN
fun getByName(name: String) = getByNameOrNull(name) ?: error("IslandType not found: '$name'")
- private fun getByNameOrNull(name: String) = entries.firstOrNull { it.displayName == name }
+ fun getByNameOrNull(name: String) = entries.firstOrNull { it.displayName == name }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
index 2f51e11f3..d2d866f36 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
@@ -128,7 +128,7 @@ object FarmingContestAPI {
fun getContestAtTime(time: Long) = contests[time]
- private fun getContestsOfType(crop: CropType) = contests.values.filter { it.crop == crop }
+ fun getContestsOfType(crop: CropType) = contests.values.filter { it.crop == crop }
fun calculateAverages(crop: CropType): Pair<Int, Map<ContestBracket, Int>> {
var amount = 0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 2fe7e2f3a..4995decc8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -19,6 +19,7 @@ import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
+import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemBlink
@@ -80,12 +81,20 @@ class GardenVisitorFeatures {
val visitor = event.visitor
val offerItem = visitor.offer!!.offerItem
- for (line in offerItem.getLore()) {
+ val lore = offerItem.getLore()
+ for (line in lore) {
if (line == "ยง7Items Required:") continue
if (line.isEmpty()) break
val pair = ItemUtils.readItemAmount(line)
if (pair == null) {
+ ErrorManager.logErrorStateWithData(
+ "Could not read items required in Visitor Inventory", "ItemUtils.readItemAmount returns null",
+ "line" to line,
+ "offerItem" to offerItem,
+ "lore" to lore,
+ "visitor" to visitor
+ )
continue
}
val (itemName, amount) = pair
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt
index c6e50e4ee..2a35519e9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt
@@ -62,7 +62,7 @@ object UpdateManager {
}
}
- private fun isBetaRelease(): Boolean {
+ fun isCurrentlyBeta(): Boolean {
return getCurrentVersion().contains("beta", ignoreCase = true)
}
@@ -82,7 +82,7 @@ object UpdateManager {
}
logger.log("Starting update check")
var updateStream = config.updateStream.get()
- if (updateStream == About.UpdateStream.RELEASES && isBetaRelease()) {
+ if (updateStream == About.UpdateStream.RELEASES && isCurrentlyBeta()) {
updateStream = About.UpdateStream.BETA
}
activePromise = context.checkUpdate(updateStream.stream)
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
index b86ac7200..635ea3351 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
@@ -62,11 +62,11 @@ class SkyHanniDebugsAndTests {
val debugLogger = LorenzLogger("debug/test")
- private fun runn(compound: NBTTagCompound, text: String) {
+ private fun run(compound: NBTTagCompound, text: String) {
print("$text'$compound'")
for (s in compound.keySet) {
val element = compound.getCompoundTag(s)
- runn(element, "$text ")
+ run(element, "$text ")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt
index b37f9b885..9bc353820 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
}
- private fun rayTrace(start: LorenzVec, direction: LorenzVec, distance: Double = 50.0): LorenzVec? {
+ 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())
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
index 611edc75b..28fc08807 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.logErrorWithData
+import at.hannibal2.skyhanni.test.command.ErrorManager
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.OpenGlHelper
@@ -366,7 +366,7 @@ object EntityOutlineRenderer {
val renderGlobal = try {
mc.renderGlobal as CustomRenderGlobal
} catch (e: NoClassDefFoundError) {
- logErrorWithData(e, "Unable to enable entity outlines, the required mixin is not loaded")
+ ErrorManager.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 7dfae5bac..5e4a63452 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 {
- private fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, colour: Int) {
+ 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 b419b46f4..a1b7ed09f 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
- private fun createSkull(displayName: String, uuid: String, value: String, lore: Array<String>?): ItemStack {
+ 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 9b7e1afdb..5078a492f 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)
- private fun isCommandKeyDown() = Keyboard.KEY_LMETA.isKeyHeld() || Keyboard.KEY_RMETA.isKeyHeld()
+ 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 2079408f7..e6929d737 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
@@ -6,9 +6,8 @@ import net.minecraft.util.AxisAlignedBB
object LocationUtils {
- private fun canSee(a: LorenzVec, b: LorenzVec): Boolean {
- return Minecraft.getMinecraft().theWorld.rayTraceBlocks(a.toVec3(), b.toVec3(), false, true, false) == null
- }
+ fun canSee(a: LorenzVec, b: LorenzVec) =
+ Minecraft.getMinecraft().theWorld.rayTraceBlocks(a.toVec3(), b.toVec3(), false, true, false) == null
fun playerLocation() = Minecraft.getMinecraft().thePlayer.getLorenzVec()
@@ -28,7 +27,7 @@ object LocationUtils {
return vec.add(0.0, 0.0 + player.getEyeHeight(), 0.0)
}
- private fun AxisAlignedBB.isVecInside(vec: LorenzVec) = isVecInside(vec.toVec3())
+ 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 88678fdd0..90970a315 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
- private fun <T> onChange(vararg properties: Property<out T>, observer: Observer<T>) {
+ 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/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 869aeeb25..03f552e7a 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
*/
- private fun drawNametag(str: String, color: Color?) {
+ 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
}
- private fun Position.transform(): Pair<Int, Int> {
+ 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()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index b0533a142..9f65a71f1 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, private val quality: GemstoneQuality) {
+ class GemstoneSlot(val type: GemstoneType, 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 12b2e4c64..dd114d8fd 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)
}
- private fun nextLexicographicallyStringWithSameLength(input: String): String {
+ 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 a03270c57..2a6d1f5ab 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
- private val elapsed get() = paused?.let { it - started } ?: started.passedSince()
+ 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 aa63f3382..9367e5ee1 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
@@ -35,7 +35,7 @@ interface Renderable {
val list = mutableMapOf<Pair<Int, Int>, List<Int>>()
var currentRenderPassMousePosition: Pair<Int, Int>? = null
- private set
+ set
fun <T> withMousePosition(posX: Int, posY: Int, block: () -> T): T {
val last = currentRenderPassMousePosition
@@ -90,7 +90,7 @@ interface Renderable {
return clickable(hoverTips(text, tips, bypassChecks = bypassChecks), onClick, bypassChecks = bypassChecks)
}
- private fun clickable(
+ fun clickable(
render: Renderable,
onClick: () -> Unit,
button: Int = 0,
@@ -195,7 +195,7 @@ interface Renderable {
return result
}
- private fun underlined(renderable: Renderable) = object : Renderable {
+ fun underlined(renderable: Renderable) = object : Renderable {
override val width: Int
get() = renderable.width
override val height = 10
@@ -207,7 +207,7 @@ interface Renderable {
}
}
- private fun hoverable(
+ fun hoverable(
hovered: Renderable,
unhovered: Renderable,
bypassChecks: Boolean = false,
@@ -254,7 +254,7 @@ interface Renderable {
}
}
- private fun placeholder(width: Int) = object : Renderable {
+ fun placeholder(width: Int) = object : Renderable {
override val width: Int = width
override val height = 10