Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Itempickup log hay bale #2873

Open
wants to merge 7 commits into
base: beta
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.toInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
Expand Down Expand Up @@ -78,7 +78,9 @@ object ItemPickupLog {
}

private val config get() = SkyHanniMod.feature.inventory.itemPickupLogConfig
private val coinIcon = "COIN_TALISMAN".asInternalName()
private val coinIcon = "COIN_TALISMAN".toInternalName()
private val HAY_BALE = "HAY_BALE".toInternalName()
private val HAY_BLOCK = "HAY_BLOCK".toInternalName()

private var itemList = mutableMapOf<Int, Pair<ItemStack, Int>>()
private var itemsAddedToInventory = mutableMapOf<Int, PickupEntry>()
Expand All @@ -101,7 +103,7 @@ object ItemPickupLog {
"ELLE_SUPPLIES",
"ELLE_FUEL_CELL",
)
private val bannedItemsConverted = bannedItemsPattern.map { it.toString().asInternalName() }
private val bannedItemsConverted = bannedItemsPattern.map { it.toString().toInternalName() }

@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent) {
Expand All @@ -122,7 +124,11 @@ object ItemPickupLog {
if (!isEnabled() || !config.sack) return

event.sackChanges.forEach {
val itemStack = (it.internalName.getItemStack())

// TODO this should not need to be done here but the whole internal name resolving needs a rework and this fixes it for now
val internalName = if (it.internalName == HAY_BALE) HAY_BLOCK else it.internalName
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code duplication of

val rawInternalName = if (it == "HAY_BALE") "HAY_BLOCK" else it

val itemStack = internalName.getItemStack()

val item = PickupEntry(itemStack.dynamicName(), it.delta.absoluteValue.toLong(), it.internalName)

updateItem(itemStack.hash(), item, itemStack, it.delta < 0)
Expand Down
Loading