ImmersiveMC

ImmersiveMC

2M Downloads

Better Item Exchanging

hammy275 opened this issue ยท 7 comments

commented

Need to do a giant QoL pass over item swapping.

commented

Main things are:

  • We should allow grabbing items even if the hand item is full (if there's inventory space).
  • Stack with items already in the inventory more often.
commented

Related: #451. This issue covers merging under the system currently in place, including non-VR players, while #451 covers the system to-be-added, which is only for VR players as of writing.

commented

There's two code paths that handle swaps:

  • ItemStorage#placeItem for world storage Immersives.
  • ImmersiveLogicHelpers#swapItems for not world storage Immersives.

These two code paths really need to be combined. However, because of how intertwined the return count logic is in the first, this is easier said than done.

I think the best approach would be to move placeItem to somewhere in ServerUtil, and make the provided ItemStorage @Nullable. From here, both methods above can call it, with the latter providing null since there are no return item counts to increment. All of the item count changing should be made into helper functions in ItemStorage to make the function far less messy.

commented

Reopening, since I'm 99% sure the item return counts get messed up when switching between two different, not empty items

commented

Downporting time:

  • 1.21.1
  • 1.20.4
  • 1.20.2
  • 1.20.1
  • 1.19.4
  • 1.19.3
  • 1.19.2
  • 1.18.2
commented

There we go.