@@ -67,50 +67,39 @@ class CookingPotContainer @JvmOverloads constructor(
6767
6868
6969 override fun quickMoveStack (playerIn : Player , index : Int ): ItemStack {
70+ if (index !in slots.indices) return ItemStack .EMPTY
71+
7072 val slot = slots[index]
7173 if (! slot.hasItem()) return ItemStack .EMPTY
7274
7375 val slotStack = slot.item
74- val originalStack = slotStack.copy() // Copy to retain original data
75-
76- // Store NBT for debugging before we move it
77- val originalData = slotStack.components
78-
76+ val originalStack = slotStack.copy()
77+ val originalComponents = slotStack.components
7978
80- val moved = false
79+ val moved = when (index) {
80+ 13 -> moveItemStackTo(slotStack, 14 , 50 , true )
8181
82- // If the slot is the crafting output (slot 13), ensure crafting logic is applied before moving
83- if (index == 13 ) {
84- // System.out.println(" - Crafting Slot Detected! Running `onTake()` before moving.");
85- slot.onTake(playerIn, slotStack)
86- }
82+ in 0 .. 13 -> moveItemStackTo(slotStack, 14 , 50 , false )
8783
88- if (index < 14 ) {
89- this .moveItemStackTo(slotStack, 14 , 49 , false )
90- } else if (index < 50 ) {
91- if (isBerryOrMaxMushrooms(originalStack)) {
92- this .moveItemStackTo(slotStack, 0 , 10 , false )
93- } else if (isBowl(originalStack)) {
94- this .moveItemStackTo(slotStack, 10 , 11 , false )
95- } else if (isCurryIngredientOrMaxHoney(originalStack)) {
96- this .moveItemStackTo(slotStack, 11 , 12 , false )
97- } else if (isLog(originalStack)) {
98- this .moveItemStackTo(slotStack, 12 , 13 , false )
84+ else -> when {
85+ isBerryOrMaxMushrooms(originalStack) -> moveItemStackTo(slotStack, 0 , 10 , false )
86+ isBowl(originalStack) -> moveItemStackTo(slotStack, 10 , 11 , false )
87+ isCurryIngredientOrMaxHoney(originalStack) -> moveItemStackTo(slotStack, 11 , 12 , false )
88+ isLog(originalStack) -> moveItemStackTo(slotStack, 12 , 13 , false )
89+ else -> false
9990 }
10091 }
10192
102- if (! ItemStack .matches(slotStack, originalStack)) {
103- slotStack.applyComponents(originalData)
104- }
93+ if (! moved) return ItemStack .EMPTY
10594
106- if (slotStack.count == 0 ) {
107- slot.safeInsert (ItemStack .EMPTY )
95+ if (slotStack.isEmpty ) {
96+ slot.set (ItemStack .EMPTY )
10897 } else {
10998 slot.setChanged()
11099 }
111100
112- if (slotStack.count == originalStack.count ) {
113- return ItemStack . EMPTY
101+ if (ItemStack .isSameItemSameComponents(slotStack, originalStack) ) {
102+ slotStack.applyComponents(originalComponents)
114103 }
115104
116105 if (index == 13 ) {
0 commit comments