From 4fe2bf3c97d9a271446374a3fc45ece5fc8e8ff0 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 23 Jan 2022 16:05:43 +0700 Subject: [PATCH] Fix cargo crate eating items on shift click --- .../ru/dbotthepony/mc/otm/menu/MenuCargoCrate.kt | 2 +- .../ru/dbotthepony/mc/otm/menu/MenuMattery.kt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuCargoCrate.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuCargoCrate.kt index 8352d824a..9cff6b48c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuCargoCrate.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuCargoCrate.kt @@ -36,6 +36,6 @@ class MenuCargoCrate @JvmOverloads constructor( } override fun getWorkingSlotEnd(): Int { - return 9 * 6 + 1 + return BlockEntityCargoCrate.CAPACITY } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMattery.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMattery.kt index b013712c2..760fe7d52 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMattery.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMattery.kt @@ -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() }