Fix cargo crate eating items on shift click

This commit is contained in:
DBotThePony 2022-01-23 16:05:43 +07:00
parent dd72e0eb1a
commit 4fe2bf3c97
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 8 additions and 8 deletions

View File

@ -36,6 +36,6 @@ class MenuCargoCrate @JvmOverloads constructor(
}
override fun getWorkingSlotEnd(): Int {
return 9 * 6 + 1
return BlockEntityCargoCrate.CAPACITY
}
}

View File

@ -218,27 +218,27 @@ abstract class MatteryMenu protected @JvmOverloads constructor(
}
val slot = slots[i]
val slot_stack = slot.item
val slotStack = slot.item
if (!slot_stack.isEmpty && ItemStack.isSameItemSameTags(stackToMove, slot_stack)) {
val j = slot_stack.count + stackToMove.count
if (!slotStack.isEmpty && ItemStack.isSameItemSameTags(stackToMove, slotStack)) {
val j = slotStack.count + stackToMove.count
val maxSize = slot.getMaxStackSize(stackToMove)
if (j <= maxSize) {
stackToMove.count = 0
if (!simulate) {
slot_stack.count = j
slotStack.count = j
slot.setChanged()
}
mergeOccurred = true
changed.add(slot)
} else if (slot_stack.count < maxSize) {
stackToMove.shrink(maxSize - slot_stack.count)
} else if (slotStack.count < maxSize) {
stackToMove.shrink(maxSize - slotStack.count)
if (!simulate) {
slot_stack.count = maxSize
slotStack.count = maxSize
slot.setChanged()
}