sakura-ryoko / itemscroller

A client-side Minecraft mod that adds various convenient ways of moving items within inventory GUIs, such as scrolling over stacks to move single items to or from it
GNU Lesser General Public License v3.0
136 stars 10 forks source link

Unable to sort #21

Open MightyPiggie opened 1 month ago

MightyPiggie commented 1 month ago

I updated to the latest version: 1.21-0.24.1-sakura.3. But now sorting seems to be fully broken. Pressing the sort hotkey doesn't seem to be doing anything. There is enough space in my inventory and hot bar, which means it should not fail.

I've tested it in a shulker, chest and the players inventory and it doesn't sort anywhere. Enabling the quicksort toggle the mod does seem to work. However only in single player for me. In multiplayer it seems to glitch by putting some random items into a shulker when sorting. Also with this toggle on, it doesn't sort like it did before. You now need to hover over an item AND pressing the hotkey button, while before you only needed to press the hotkey button.

(In the gifs down below I am constantly pressing the hotkey button for sort)

Here is singeplayer with the sortInventoryToggle set to false Here is singeplayer with the sortInventoryToggle set to true And here is multiplayer with the sortInventoryToggle set to true

sakura-ryoko commented 1 month ago

A couple things here.

Video # 1 sortInventoryToggle disables the sorting function, so having it disabled, will not trigger sorting.

Video # 2; the sorting seems to be working. Are you hovering over an item while pressing "R" ? Have you tried changing the sorting options to see if you get different results? -- Also, when you have the Shulker Box screen open; the mod can only sort within the shulker box; or your inventory at once. It will only sort in either or; and it will not sort using both inventories. The game for whatever reason treats both halves of the Inventory differently; and that's not something that I changed. It just fails to work with both halves.

Video # 3 is a bit more interesting to describe; because with the newer fixes and my inspection into the code; I found that whenever your Inventory is FULL like you have pictured; the sorting will fail. In order to properly sort with the shulker box screen; the mod needs to have up to 2-3 free "slots" on your hotbar in order to function properly. The mod is designed to automatically "swap" items out of your hotbar in order for sorting to work; but if your hotbar doesn't have enough slots free; it will not work. This is why you are seeing the mod trying to swap items into the Shulker box because it is trying to free up Hotbar slots; and clearly, you cannot Swap a Shulker box into a Shulker box (The third from last item in your hotbar)

The code is currently designed to fail and cancel out of the sorting process and display messages in the log when sorting fails for different reasons. Previously, these things would cause the mod to freeze; is why I had to make such changes. The hotbar requirements from my own testing was kind of a crude "fix" to make the sorting work as expected when sorting inside of the shulker box. Why? I don't know I just did what was able to get it to work. The code was originally written by another person.

It's primarily when working with Shulker boxes is when these strange problems occur.

MightyPiggie commented 1 month ago

Huh, that is strange. I was running an old version before 1.21-0.23.999-sakura.8 to be precise. And it was working there for a long time until it started crashing. I never touched the sortInventoryToggle which means it was set to false. Unless that was changed recently, but I couldn't find it in the changelog.

As far as I understand the code, when the hotbar is full it should give a warning in the console right? I never see that warning happening.

But thanks for the help and explaining it!

Aculoss commented 1 month ago

Tools seems to swap slots to middle of my inventory and not hotbar when sorting a shulker box.

sakura-ryoko commented 1 week ago

Try it with 1.21.3.