Follow quickmove slot priorities of vanilla
This commit is contained in:
parent
4430fdcb6b
commit
3b6bac1a83
@ -195,11 +195,11 @@ class ExopackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMen
|
|||||||
|
|
||||||
if (slotIndex == craftingResultSlot.index) {
|
if (slotIndex == craftingResultSlot.index) {
|
||||||
val item = craftingResultSlot.item
|
val item = craftingResultSlot.item
|
||||||
val leftover = moveItemStackToSlots(item, playerInventorySlots2, simulate = true)
|
val leftover = moveItemStackToSlots(item, playerInventorySlots, simulate = true)
|
||||||
|
|
||||||
if (leftover.isEmpty) {
|
if (leftover.isEmpty) {
|
||||||
val copy = item.copy()
|
val copy = item.copy()
|
||||||
moveItemStackToSlots(item, playerInventorySlots2, simulate = false)
|
moveItemStackToSlots(item, playerInventorySlots, simulate = false)
|
||||||
item.count = 0
|
item.count = 0
|
||||||
craftingResultSlot.onTake(ply, copy)
|
craftingResultSlot.onTake(ply, copy)
|
||||||
return copy
|
return copy
|
||||||
|
@ -104,7 +104,6 @@ abstract class MatteryMenu(
|
|||||||
val ply: Player get() = inventory.player
|
val ply: Player get() = inventory.player
|
||||||
|
|
||||||
private val _playerInventorySlots = ArrayList<InventorySlot>()
|
private val _playerInventorySlots = ArrayList<InventorySlot>()
|
||||||
private val _playerInventorySlots2 = ArrayList<InventorySlot>()
|
|
||||||
private val _playerHotbarSlots = ArrayList<InventorySlot>()
|
private val _playerHotbarSlots = ArrayList<InventorySlot>()
|
||||||
private val _playerMainSlots = ArrayList<InventorySlot>()
|
private val _playerMainSlots = ArrayList<InventorySlot>()
|
||||||
private val _playerExoSuitSlots = ArrayList<InventorySlot>()
|
private val _playerExoSuitSlots = ArrayList<InventorySlot>()
|
||||||
@ -189,15 +188,10 @@ abstract class MatteryMenu(
|
|||||||
fun stringInput(allowSpectators: Boolean = false, handler: (String) -> Unit) = PlayerInput(BinaryStringCodec, allowSpectators, handler)
|
fun stringInput(allowSpectators: Boolean = false, handler: (String) -> Unit) = PlayerInput(BinaryStringCodec, allowSpectators, handler)
|
||||||
fun intInput(allowSpectators: Boolean = false, handler: (Int) -> Unit) = PlayerInput(VarIntValueCodec, allowSpectators, handler)
|
fun intInput(allowSpectators: Boolean = false, handler: (Int) -> Unit) = PlayerInput(VarIntValueCodec, allowSpectators, handler)
|
||||||
|
|
||||||
/**
|
|
||||||
* inventory + exosuit + hotbar (in this order)
|
|
||||||
*/
|
|
||||||
val playerInventorySlots: List<InventorySlot> = Collections.unmodifiableList(_playerInventorySlots)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hotbar + inventory + exosuit (in this order)
|
* hotbar + inventory + exosuit (in this order)
|
||||||
*/
|
*/
|
||||||
val playerInventorySlots2: List<InventorySlot> = Collections.unmodifiableList(_playerInventorySlots2)
|
val playerInventorySlots: List<InventorySlot> = Collections.unmodifiableList(_playerInventorySlots)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hotbar only
|
* hotbar only
|
||||||
@ -368,12 +362,15 @@ abstract class MatteryMenu(
|
|||||||
mapQuickMoveToInventory(offhandSlot!!)
|
mapQuickMoveToInventory(offhandSlot!!)
|
||||||
addSlot(offhandSlot!!)
|
addSlot(offhandSlot!!)
|
||||||
|
|
||||||
for (i in 9 .. 35) {
|
for (i in 0 .. 35) {
|
||||||
val slot = InventorySlot(inventory, i)
|
val slot = InventorySlot(inventory, i)
|
||||||
|
|
||||||
_playerInventorySlots.add(slot)
|
_playerInventorySlots.add(slot)
|
||||||
_playerInventorySlots2.add(slot)
|
|
||||||
_playerMainSlots.add(slot)
|
_playerMainSlots.add(slot)
|
||||||
|
|
||||||
|
if (i <= 8)
|
||||||
|
_playerHotbarSlots.add(slot)
|
||||||
|
else
|
||||||
_playerCombinedInventorySlots.add(slot)
|
_playerCombinedInventorySlots.add(slot)
|
||||||
|
|
||||||
mapQuickMove(slot, equipmentSlots)
|
mapQuickMove(slot, equipmentSlots)
|
||||||
@ -388,7 +385,6 @@ abstract class MatteryMenu(
|
|||||||
val slot = InventorySlot(mattery.exopackContainer, i)
|
val slot = InventorySlot(mattery.exopackContainer, i)
|
||||||
|
|
||||||
_playerInventorySlots.add(slot)
|
_playerInventorySlots.add(slot)
|
||||||
_playerInventorySlots2.add(slot)
|
|
||||||
_playerExoSuitSlots.add(slot)
|
_playerExoSuitSlots.add(slot)
|
||||||
_playerCombinedInventorySlots.add(slot)
|
_playerCombinedInventorySlots.add(slot)
|
||||||
|
|
||||||
@ -404,18 +400,6 @@ abstract class MatteryMenu(
|
|||||||
|
|
||||||
exopackPowerLevel.with(mattery.exopackEnergy)
|
exopackPowerLevel.with(mattery.exopackEnergy)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i in 0..8) {
|
|
||||||
val slot = InventorySlot(inventory, i)
|
|
||||||
|
|
||||||
_playerInventorySlots2.add(i, slot)
|
|
||||||
_playerInventorySlots.add(slot)
|
|
||||||
_playerHotbarSlots.add(slot)
|
|
||||||
|
|
||||||
mapQuickMove(slot, equipmentSlots)
|
|
||||||
mapQuickMoveToExternal(slot)
|
|
||||||
addSlot(slot)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var broadcastOnce = false
|
private var broadcastOnce = false
|
||||||
|
Loading…
Reference in New Issue
Block a user