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
|
||||
} else if (playerCombinedInventorySlots.any { it.index == slotIndex }) {
|
||||
val item = slots[slotIndex].item
|
||||
val copy = item.copy()
|
||||
moveItemStackTo(item, playerHotbarSlots)
|
||||
val copy = slots[slotIndex].item.copy()
|
||||
|
||||
if (moveItemStackTo(slots[slotIndex], playerHotbarSlots))
|
||||
return copy
|
||||
else
|
||||
return ItemStack.EMPTY
|
||||
} else if (playerHotbarSlots.any { it.index == slotIndex }) {
|
||||
val item = slots[slotIndex].item
|
||||
val copy = item.copy()
|
||||
moveItemStackTo(item, playerCombinedInventorySlots)
|
||||
val copy = slots[slotIndex].item.copy()
|
||||
|
||||
if (moveItemStackTo(slots[slotIndex], playerCombinedInventorySlots))
|
||||
return copy
|
||||
else
|
||||
return ItemStack.EMPTY
|
||||
} else if (craftingSlots.any { it.index == slotIndex }) {
|
||||
val item = slots[slotIndex].item
|
||||
val copy = item.copy()
|
||||
moveItemStackTo(item, playerInventorySlots)
|
||||
val copy = slots[slotIndex].item.copy()
|
||||
|
||||
if (moveItemStackTo(slots[slotIndex], playerInventorySlots))
|
||||
return copy
|
||||
else
|
||||
return ItemStack.EMPTY
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY
|
||||
|
@ -342,6 +342,26 @@ abstract class MatteryMenu @JvmOverloads protected constructor(
|
||||
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 {
|
||||
val copy = item.copy()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user