Ender Utilities

Ender Utilities

17M Downloads

Handy Bag Sorting is Borked with certain items

brisingraerowing opened this issue ยท 4 comments

commented

Trying to sort a handy bag page with certain items causes some rather odd behavior, and doesn't actually sort anything:

2017-05-05_23 11 30

2017-05-05_23 11 33

Clicking the sort button just toggles between those two layouts.

(Those canisters are from the Pressure Pipes mod).

commented

The canisters use NBT to store the fluid name and the quantity. Each canister stack has a different type of fluid, or in the first (largest) stack, they are empty.

The sort only splits/combines the empty ones, and leaves the full ones in the same (relative) slots.

Here's the level.dat

level.dat.zip

commented

I found and fixed the issue.

Since you mentioned "and doesn't actually sort anything" earlier: the sort feature in my inventories is a rather basic sort, which sorts items according to only 3 criteria:

  • Any blocks (in code, items that are ItemBlocks) are sorted/moved to the beginning of the inventory, and the rest of the items come after those ItemBlocks
  • The items are sorted based on their registry names first
  • In case there are items with identical registry names in several slots, then those are sorted based on their metadata/damage value

This means in your case, that none of the canisters will ever switch relative positions, because they are all the same item and thus the same registry name, and they all have the same metadata of 0, since they ONLY store data in NBT.

There is no easy generic way to meaningfully sort them based on NBT data. It would pretty much require adding a special case/separate rule for NBT-based sorting for each and every item that exists in any mod.

commented

I figured that. I still can sort them as I want to easily enough.

commented

Hmm, okay... I'm going to need more information...

  • Are ALL of the canisters in the separate slots in the first picture actually different items?
  • And then the sort splits them up and then combines them again?
  • Do you know if the canisters have NBT data or Capabilities on them, or just different metadata/damage values?

If this is on single player, could you send me your level.dat file (which contains the player's inventory) so that I could test this out with your bag and the canisters you have. Or if this is on a server, if you have access to your player data file, then that one. Thanks.