Fix quick move to nearby chests treating every chest equally

and possibly creating situation where items of one type of one of chests go into empty slots of different (unrelated) chest(s)
This commit is contained in:
DBotThePony 2025-03-18 22:55:17 +07:00
parent 06a621d370
commit 36f6a12395
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 7 additions and 10 deletions

View File

@ -22,6 +22,7 @@ class QuickMoveInput(private val menu: MatteryMenu, val from: Collection<Slot>,
Widgets18.RESTOCK_TO_STORAGE
) {
override fun move(from: Collection<Slot>, to: Collection<Slot>, player: Player) {
if (from.isEmpty() || to.isEmpty()) return
val (_, itemsFrom) = computeSlotLists(from, true)
val (_, itemsTo) = computeSlotLists(to, false)
@ -39,6 +40,7 @@ class QuickMoveInput(private val menu: MatteryMenu, val from: Collection<Slot>,
Widgets18.RESTOCK_WITH_MOVE_TO_STORAGE
) {
override fun move(from: Collection<Slot>, to: Collection<Slot>, player: Player) {
if (from.isEmpty() || to.isEmpty()) return
val (_, itemsFrom) = computeSlotLists(from, true)
val (emptyTo, itemsTo) = computeSlotLists(to, false)
@ -60,6 +62,7 @@ class QuickMoveInput(private val menu: MatteryMenu, val from: Collection<Slot>,
Widgets18.MOVE_EVERYTHING_TO_STORAGE
) {
override fun move(from: Collection<Slot>, to: Collection<Slot>, player: Player) {
if (from.isEmpty() || to.isEmpty()) return
val toSorted = prioritySortSlots(to)
from.forEach {

View File

@ -470,8 +470,6 @@ class QuickStackPacket(
val ignoreBlockstates = HashSet<BlockState>()
findCaps.forEach { (b, _) -> ignoreBlockstates.add(b.blockState) }
val slots = ArrayList<Slot>()
for ((blockEntity, cap) in findCaps) {
// don't interact through walls
val trace = player.serverLevel().isBlockInLine(ClipBlockStateContext(eyes, Vector.atCenterOf(blockEntity.blockPos)) {
@ -479,16 +477,12 @@ class QuickStackPacket(
})
if (trace.blockPos == blockEntity.blockPos) {
slots.addAll(cap.getSlotsFor(player))
if (fromExopack)
mode.move(player.matteryPlayer.exoPackMenu.playerCombinedInventorySlots, cap.getSlotsFor(player), player)
else
mode.move(cap.getSlotsFor(player), player.matteryPlayer.exoPackMenu.playerInventorySlots, player)
}
}
if (slots.isEmpty()) return
if (fromExopack)
mode.move(player.matteryPlayer.exoPackMenu.playerCombinedInventorySlots, slots, player)
else
mode.move(slots, player.matteryPlayer.exoPackMenu.playerInventorySlots, player)
}
override fun type(): CustomPacketPayload.Type<out CustomPacketPayload> {