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:
parent
06a621d370
commit
36f6a12395
@ -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 {
|
||||
|
@ -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> {
|
||||
|
Loading…
Reference in New Issue
Block a user