More exosuit quickmove fixes
This commit is contained in:
parent
d47fc7af41
commit
5f649d0d7e
@ -120,20 +120,26 @@ class ExoSuitInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMen
|
|||||||
|
|
||||||
return ItemStack.EMPTY
|
return ItemStack.EMPTY
|
||||||
} else if (playerCombinedInventorySlots.any { it.index == slotIndex }) {
|
} else if (playerCombinedInventorySlots.any { it.index == slotIndex }) {
|
||||||
val item = slots[slotIndex].item
|
val copy = slots[slotIndex].item.copy()
|
||||||
val copy = item.copy()
|
|
||||||
moveItemStackTo(item, playerHotbarSlots)
|
if (moveItemStackTo(slots[slotIndex], playerHotbarSlots))
|
||||||
return copy
|
return copy
|
||||||
|
else
|
||||||
|
return ItemStack.EMPTY
|
||||||
} else if (playerHotbarSlots.any { it.index == slotIndex }) {
|
} else if (playerHotbarSlots.any { it.index == slotIndex }) {
|
||||||
val item = slots[slotIndex].item
|
val copy = slots[slotIndex].item.copy()
|
||||||
val copy = item.copy()
|
|
||||||
moveItemStackTo(item, playerCombinedInventorySlots)
|
if (moveItemStackTo(slots[slotIndex], playerCombinedInventorySlots))
|
||||||
return copy
|
return copy
|
||||||
|
else
|
||||||
|
return ItemStack.EMPTY
|
||||||
} else if (craftingSlots.any { it.index == slotIndex }) {
|
} else if (craftingSlots.any { it.index == slotIndex }) {
|
||||||
val item = slots[slotIndex].item
|
val copy = slots[slotIndex].item.copy()
|
||||||
val copy = item.copy()
|
|
||||||
moveItemStackTo(item, playerInventorySlots)
|
if (moveItemStackTo(slots[slotIndex], playerInventorySlots))
|
||||||
return copy
|
return copy
|
||||||
|
else
|
||||||
|
return ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.EMPTY
|
return ItemStack.EMPTY
|
||||||
|
@ -342,6 +342,26 @@ abstract class MatteryMenu @JvmOverloads protected constructor(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun moveItemStackTo(
|
||||||
|
source: Slot,
|
||||||
|
slots: Collection<Slot>
|
||||||
|
): Boolean {
|
||||||
|
val remainder = moveItemStackToSlots(source.item, slots)
|
||||||
|
|
||||||
|
if (remainder.count == source.item.count) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remainder.isEmpty) {
|
||||||
|
source.set(ItemStack.EMPTY)
|
||||||
|
} else {
|
||||||
|
source.item.count = remainder.count
|
||||||
|
source.setChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
fun moveItemStackToSlots(item: ItemStack, slots: Collection<Slot>, simulate: Boolean = false): ItemStack {
|
fun moveItemStackToSlots(item: ItemStack, slots: Collection<Slot>, simulate: Boolean = false): ItemStack {
|
||||||
val copy = item.copy()
|
val copy = item.copy()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user