Ability to treat a group of items as one item
RandomGgames opened this issue ยท 6 comments
A really nice feature to have would be to be able to sort multiple items into a row when sorting into rows. What I mean by this is, when sorting into rows, instead of one item per row, create a list of items that are sorted onto that one row, almost being treated as the same item.
Example config (something along the lines of):
@default
@diamonds
@iron
@gold
@bookstuff
@diamonds(together = true)
diamond_block
diamond
diamond_ore
@iron(together = true)
iron_block
iron_ingot
iron_nuggets
iron_ore
@gold
gold block
gold_ingot
@bookstuff(together = true)
book
paper
And when these items are in a chest and it is sorted into rows, the items would be laid out as follows:
Row 1: diamond blocks, diamonds, diamond ore
Row 2: iron blocks, iron ingots, iron nuggets, iron ore
Row 3: gold block
Row 4: gold ingot
Row 5: book, paper
Sounds very useful.
That said I've spend last two days in trying to understand how exactly sorting/moving works. Ether my command of Kotlin is not on high enough level or the code is a nice and very well tangled spaghetti bowl :).... Probably the first.. So implementing changes to sorting will be very hard for now.
Yeah that's fair... I'm just happy this mod is being updated to the latest version. Is the code for sorting visible in the git? If so where exactly? I'm curious to see what it might look like... I've never created mods so curious how bad it actually is :P
it's generally here
https://github.com/blackd/Inventory-Profiles/tree/all-in-one/platforms/fabric-1.17/src/main/java/org/anti_ad/mc/ipnext/inventory
it's mostly the same for all platforms it just uses the MC binding directly so it's hard to move to common.
the doXXXX methods in https://github.com/blackd/Inventory-Profiles/blob/all-in-one/platforms/fabric-1.17/src/main/java/org/anti_ad/mc/ipnext/inventory/GeneralInventoryActions.kt are invoked when the shortcuts are pressed/clicked :)
sorting/moving work by creating a desired state of the whole inventory and then using the https://github.com/blackd/Inventory-Profiles/tree/all-in-one/platforms/fabric-1.17/src/main/java/org/anti_ad/mc/ipnext/inventory/sandbox/diffcalculator to generate a list of clicks to achieve it.
Sounds simple ain't it :)
Oh yeah, sounds simple... looks inside Oh nvm.. Ha! I know a fair amount of python and some basic JavaScript but this just looks like nonsense oh my.
YES :)
But to be honest all functional languages looks like bunch of gibberish to people coming from the imperative world. But even with my fair amount of LISP and derivates knowledge the strange mixture of OOP and functional that Kotlin is makes me doubt my self.
Anyway it looks like introducing new sorting algorithm might not be that hard after all, since it already have 3.
Disclaimer: This is not a promise. I might never do it :)
But fist I'll be looking into #12 it looks much easier.