Fix stacksize being shared by different item stacks
This commit is contained in:
@@ -47,6 +47,10 @@ data class SBItemStack(
|
|||||||
|
|
||||||
object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
|
object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
|
||||||
override fun equals(o1: SBItemStack, o2: SBItemStack, context: ComparisonContext): Boolean {
|
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
|
return o1.skyblockId == o2.skyblockId
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +77,7 @@ object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
|
|||||||
|
|
||||||
override fun hash(entry: EntryStack<SBItemStack>, value: SBItemStack, context: ComparisonContext): Long {
|
override fun hash(entry: EntryStack<SBItemStack>, value: SBItemStack, context: ComparisonContext): Long {
|
||||||
// Repo items are immutable, and get replaced entirely when loaded from disk
|
// 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 {
|
override fun wildcard(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack {
|
||||||
|
|||||||
Reference in New Issue
Block a user