aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-02-05 11:34:40 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-02-05 11:34:40 +0100
commit3504ea84c69e38943f42ae006596f0b46cbf005e (patch)
treeae8e963284cf90bd20c314ccd636537b8ad8549b /src
parent62f4d8cd10210ea255860f37ffde62180d3400fe (diff)
downloadskyhanni-3504ea84c69e38943f42ae006596f0b46cbf005e.tar.gz
skyhanni-3504ea84c69e38943f42ae006596f0b46cbf005e.tar.bz2
skyhanni-3504ea84c69e38943f42ae006596f0b46cbf005e.zip
code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt13
4 files changed, 23 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java
index 654dcf511..92ab5bb16 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java
@@ -121,7 +121,6 @@ public class VisitorConfig {
@FeatureToggle
public boolean highlightVisitors = false;
-
@Expose
@ConfigOption(
name = "Block Interacting with Visitors",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt
index 022ec07b9..9e77ab6e4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt
@@ -54,15 +54,15 @@ class CosmeticFollowingLine {
val last7 = locations.keys.toList().takeLast(7)
val last2 = locations.keys.toList().takeLast(2)
- for ((a, b) in locations.keys.zipWithNext()) {
+ locations.keys.zipWithNext { a, b ->
val locationSpot = locations[b]!!
if (firstPerson && !locationSpot.onGround && b in last7) {
// Do not render the line in the face, keep more distance while the line is in the air
- continue
+ return
}
if (b in last2 && locationSpot.time.passedSince() < 400.milliseconds) {
// Do not render the line directly next to the player, prevent laggy design
- continue
+ return
}
event.draw3DLine(a, b, color, locationSpot.getWidth(), !config.behindBlocks)
}
@@ -81,7 +81,8 @@ class CosmeticFollowingLine {
private fun renderClose(event: LorenzRenderWorldEvent, firstPerson: Boolean, color: Color) {
if (firstPerson && latestLocations.any { !it.value.onGround }) return
- for ((a, b) in latestLocations.keys.zipWithNext()) {
+
+ latestLocations.keys.zipWithNext { a, b ->
val locationSpot = latestLocations[b]!!
event.draw3DLine(a, b, color, locationSpot.getWidth(), !config.behindBlocks)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt
index bc20b44a3..6e0d8e400 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt
@@ -4,7 +4,8 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
+import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent
import io.github.moulberry.notenoughupdates.events.SlotClickEvent
import io.github.moulberry.notenoughupdates.util.Utils
@@ -18,8 +19,15 @@ class GardenDeskInSBMenu {
private var showItem = false
private val item by lazy {
- val neuItem = NEUItems.getItemStack("DOUBLE_PLANT")
- Utils.createItemStack(neuItem.item, "§bDesk", "§7Click here to", "§7run §e/desk")
+ val neuItem = "DOUBLE_PLANT".asInternalName().getItemStack()
+ Utils.createItemStack(
+ neuItem.item,
+ "§bOpen Desk",
+ "§8(From SkyHanni)",
+ "",
+ "§7Click here to",
+ "§7run §e/desk"
+ )
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
index 93e12cc6f..36eaa7a24 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
@@ -23,6 +23,7 @@ import java.util.Collections
class KingTalismanHelper {
private val config get() = SkyHanniMod.feature.mining.kingTalisman
+ private val storage get() = ProfileStorageData.profileSpecific?.mining
companion object {
private var currentOffset: Int? = null
@@ -63,14 +64,14 @@ class KingTalismanHelper {
fun onTick(event: LorenzTickEvent) {
if (!event.isMod(20)) return
if (!isEnabled()) return
- val profileSpecific = ProfileStorageData.profileSpecific ?: return
+ val storage = storage ?: return
val nearby = isNearby()
if (nearby && getCurrentOffset() == null) {
checkOffset()
}
- val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo
+ val kingsTalkedTo = storage.kingsTalkedTo
if (getCurrentOffset() == null) {
val allKings = kingsTalkedTo.size == kingCircles.size
display = if (allKings) emptyList() else listOf("§cVisit the king to sync up.")
@@ -103,10 +104,10 @@ class KingTalismanHelper {
if (!isEnabled()) return
if (getCurrentOffset() == null) return
if (!isNearby()) return
- val profileSpecific = ProfileStorageData.profileSpecific ?: return
+ val storage = storage ?: return
val currentKing = getCurrentKing()
- val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo
+ val kingsTalkedTo = storage.kingsTalkedTo
if (currentKing !in kingsTalkedTo) {
LorenzUtils.debug("Found new king!")
kingsTalkedTo.add(currentKing)
@@ -154,8 +155,8 @@ class KingTalismanHelper {
}
private fun nextMissingText(): String {
- val profileSpecific = ProfileStorageData.profileSpecific ?: error("profileSpecific is null")
- val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo
+ val storage = storage ?: error("profileSpecific is null")
+ val kingsTalkedTo = storage.kingsTalkedTo
val (nextKing, until) = getKingTimes().filter { it.key !in kingsTalkedTo }.sorted().firstNotNullOf { it }
val time = TimeUtils.formatDuration(until, maxUnits = 2)