Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Aug 26, 2024
1 parent acaaa66 commit 0de9891
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/at/hannibal2/skyhanni/features/mining/ForgeGfs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ object ForgeGfs {

private val confirmScreenPattern by patternGroup.pattern(
"recipe.confirm",
"Confirm Process\$"
"Confirm Process",
)

private val config get() = SkyHanniMod.feature.mining.forgeGfs
private val config get() = SkyHanniMod.feature.mining

private val gfsFakeItem by lazy {
ItemUtils.createSkull(
Expand All @@ -41,16 +41,15 @@ object ForgeGfs {
"RleHR1cmUvODBhMDc3ZTI0OGQxNDI3NzJlYTgwMDg2NGY4YzU3OGI5ZDM2ODg1YjI5ZGFmODM2YjY0YTcwNjg4MmI2ZWMxMCIKICAgIH0KICB9Cn0=",
"§8(from SkyHanni)",
"§7Click here to try to get all of this",
"§7recipe's ingredients from sacks."
"§7recipe's ingredients from sacks.",
)
}

private var showFakeItem = false

@SubscribeEvent
fun onInventoryOpen(event: InventoryUpdatedEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config) return
if (!isEnabled()) return
if (!confirmScreenPattern.matches(event.inventoryName)) return

showFakeItem = true
Expand All @@ -70,7 +69,7 @@ object ForgeGfs {

@SubscribeEvent
fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
if (!config) return
if (!isEnabled()) return
if (!showFakeItem || event.slotId != 53) return

event.cancel()
Expand Down Expand Up @@ -101,4 +100,6 @@ object ForgeGfs {
private fun MutableMap<NEUInternalName, Int>.addAndFold(key: NEUInternalName, value: Int) {
this[key] = this.getOrDefault(key, 0) + value
}

fun isEnabled() = LorenzUtils.inSkyBlock && config.forgeGfs
}

0 comments on commit 0de9891

Please sign in to comment.