diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-31 02:01:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 02:01:17 +0200 |
commit | e64ef144b0bab409d0d4edbef12b42744dbbf9a8 (patch) | |
tree | 2868fa5c38406cff23fc66544185db527b11fdce /src/main/java/at/hannibal2/skyhanni/features/minion | |
parent | 60cb0823bcc72f901c1e8fdc3a35b2cb59809989 (diff) | |
download | skyhanni-e64ef144b0bab409d0d4edbef12b42744dbbf9a8.tar.gz skyhanni-e64ef144b0bab409d0d4edbef12b42744dbbf9a8.tar.bz2 skyhanni-e64ef144b0bab409d0d4edbef12b42744dbbf9a8.zip |
Improvement: /shclearminiondata (#1951)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/minion')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index feadbd108..bad1fe543 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -59,7 +59,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -class MinionFeatures { +object MinionFeatures { private val config get() = SkyHanniMod.feature.misc.minions private var lastClickedEntity: LorenzVec? = null @@ -175,7 +175,6 @@ class MinionFeatures { val minions = minions ?: return val entity = lastClickedEntity ?: return - val openInventory = event.inventoryName val name = getMinionName(openInventory) if (!minions.contains(entity) && LorenzUtils.skyBlockIsland != IslandType.HUB) { @@ -198,7 +197,7 @@ class MinionFeatures { lastMinionOpened = 0 } - private fun removeBuggedMinions() { + fun removeBuggedMinions(isCommand: Boolean = false) { if (!IslandType.PRIVATE_ISLAND.isInIsland()) return val minions = minions ?: return @@ -212,8 +211,13 @@ class MinionFeatures { } val size = removedEntities.size - if (size == 0) return - Companion.minions = minions.editCopy { + if (size == 0) { + if (isCommand) { + ChatUtils.chat("No bugged minions found nearby.") + } + return + } + this.minions = minions.editCopy { for (removedEntity in removedEntities) { remove(removedEntity) } @@ -396,26 +400,18 @@ class MinionFeatures { } } - companion object { + var lastMinion: LorenzVec? = null + var lastStorage: LorenzVec? = null + var minionInventoryOpen = false + var minionStorageInventoryOpen = false - var lastMinion: LorenzVec? = null - var lastStorage: LorenzVec? = null - var minionInventoryOpen = false - var minionStorageInventoryOpen = false - - private var minions: Map<LorenzVec, ProfileSpecificStorage.MinionConfig>? - get() { - return ProfileStorageData.profileSpecific?.minions - } - set(value) { - ProfileStorageData.profileSpecific?.minions = value - } - - fun clearMinionData() { - minions = mutableMapOf() - ChatUtils.chat("Manually reset all private island minion location data!") + private var minions: Map<LorenzVec, ProfileSpecificStorage.MinionConfig>? + get() { + return ProfileStorageData.profileSpecific?.minions + } + set(value) { + ProfileStorageData.profileSpecific?.minions = value } - } @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { |