Inventory Sorting

Inventory Sorting

12M Downloads

[Suggestion] Add ability to lock certan items / item types in place in inventory / hotbar

Mackzwellz opened this issue ยท 0 comments

commented

I really miss this feature from InventoryTweaks Forge mod, and I'm not alone who would like to have this.

I would like to be able to define a list of items (not user friendly but simple enough) or item groups/types (e.g. weapons, tools, decoration; may be based on tags?) that should be put in each cell / row / column in any inventory (player, chest, barrel, maybe modded inventories like backpacks later).

At the very least, I would like to be able to define a list of items to be put in each hotbar slot. First item in the list would take priority over second one, if first exists in inventory. If no items from the list exist in inventory, slot can be filled by any item (if inventory is full) or left empty by default. I think the list should accept namespaced ids in one form or another.
E.g. H1=item:diamond_sword,item:iron_sword would try to put diamond sword in hotbar slot 1; then, if no diamond sword is in inventory, try to put iron sword; if not found - leave blank / fill according to sort pattern.
Same type of config should be available for other hotbar slots.

Later you could consider adding support for tags, as well as custom item groups like group:hoeaxeshovel (see InvTweaks Tree example below). If it's possbile, common groups like tools, weapons, as well as more precise ones like swords, axes, minecarts should be available by default (but not sure where to get the info for this from, since there are no such tags; InvTweaks provided its own default groups that were maintained manually by developer).
I think you can have something similar to groups if you add wildcard searches, e.g. item:*_sword to find all swords, then apply descending sort by item quality/durability/etc. (higher quality should be above in the list).

Examples of my setup / use case from Inventory Tweaks are below.

Code for original Forge mod is available in:
https://github.com/skiptirengu/inventory-tweaks/tree/mc-1.15.x (possibly updated fork for 1.15)
https://github.com/reo-ar/InvTweaksRenewed (rewrite/port for 1.16)

This guy does something similar to what I propose here, but currently lacks features needed for it to work:
https://github.com/jsnimda/Inventory-Profiles

Hope this isn't too much and could be considered for inclusion in this mod (at least hotbar & simple item list part).


Readme copypasted from InvTweaks Rules file:

# SORTING RULES
# Each line you type is a new constraint you add for sorting your inventory.
# After any change, just press the sorting key to reload the settings. Some examples:
# * "D1 sword" puts any sword in row D, column 1 (see grid below)
# * "A edibleFood" fills the A row with food
# * "1 ironPickaxe" fills the 1 column with an iron pickaxe
# * "A1-C4 blocks" fills the rectangle with any blocks
# * "D LOCKED" avoids items from the hotbar to move out of it when sorting

# INVENTORY GRID
#     1   2   3   4   5   6   7   8   9
# A [A1][A2][A3][A4][A5][A6][A7][A8][A9]
# B [B1][B2][B3][B4][B5][B6][B7][B8][B9]
# C [C1][C2][C3][C4][C5][C6][C7][C8][C9]
#  
# D [D1][D2][D3][D4][D5][D6][D7][D8][D9]

# AVAILABLE KEYWORDS
# Open the 'InvTweaksTree.txt' file for a list of available keywords. If an item
# is missing from the item tree (for example mod items), you can either add it 
# or create a rule by ID. Examples: "D5 203", "D9 12345-13"

Example of Rules config (D = hotbar):

D1 pickaxe
D2 lightEmissive
D3 weapon
D4 hoeAxeShovel
D5 edibleFood
D6 additionalTool
D7 stones
D8 dirts
D9 misc

A9 craftingTable
B9 coal
A8 wood
B8 woodenPlank
C8 sticks

Example of custom item group definition from InvTweaks Tree file (used in Rules config):

<customprofile>
    <hoeAxeShovel>
        <hoe>
            <goldHoe id="golden_hoe" />
            <diamondHoe id="diamond_hoe" />
            <ironHoe id="stone_hoe" />
            <stoneHoe id="iron_hoe" />
            <woodHoe id="wooden_hoe" />
        </hoe>
        <axe>
            <goldAxe id="golden_axe" />
            <diamondAxe id="diamond_axe" />
            <ironAxe id="iron_axe" />
            <stoneAxe id="stone_axe" />
            <woodAxe id="wooden_axe" />
        </axe>
        <shovel>
            <goldShovel id="golden_shovel" />
            <diamondShovel id="diamond_shovel" />
            <ironShovel id="iron_shovel" />
            <stoneShovel id="stone_shovel" />
            <woodShovel id="wooden_shovel" />
        </shovel>
    </hoeAxeShovel>
    <additionalTool>
        <flintAndSteel id="flint_and_steel" />
        <shears id="shears" />
        <fishingRod id="fishing_rod" />
        <waterBucket id="water_bucket" />
        <minecart id="minecart" />
        <emptyBucket id="bucket" />
    </additionalTool>
    <misc>
        <craftingTable id="crafting_table" />
        <furnace id="furnace" />
    </misc>
</customprofile>