aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-05-29 23:33:46 +0200
committernea <nea@nea.moe>2023-05-29 23:33:46 +0200
commitedb723e4230ad0c67518a2323273871735db728d (patch)
tree6bba0fe6bbd54c5ee29aa45131a59a9f34ecd9df /src/main/kotlin/moe/nea
parentdd0afac3a8459035827dac36986a690c8a9541ea (diff)
downloadFirmament-edb723e4230ad0c67518a2323273871735db728d.tar.gz
Firmament-edb723e4230ad0c67518a2323273871735db728d.tar.bz2
Firmament-edb723e4230ad0c67518a2323273871735db728d.zip
Fix stacksize being shared by different item stacks
Diffstat (limited to 'src/main/kotlin/moe/nea')
-rw-r--r--src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt b/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt
index a6d683d..3f6ac75 100644
--- a/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt
+++ b/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt
@@ -47,6 +47,10 @@ data class SBItemStack(
object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
override fun equals(o1: SBItemStack, o2: SBItemStack, context: ComparisonContext): Boolean {
+ if (!context.isFuzzy) {
+ if (o1.stackSize != o2.stackSize)
+ return false
+ }
return o1.skyblockId == o2.skyblockId
}
@@ -73,7 +77,7 @@ object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
override fun hash(entry: EntryStack<SBItemStack>, value: SBItemStack, context: ComparisonContext): Long {
// Repo items are immutable, and get replaced entirely when loaded from disk
- return value.skyblockId.hashCode() * 31L
+ return value.skyblockId.hashCode() * 31L + if (!context.isExact) value.stackSize else 0
}
override fun wildcard(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack {