diff --git a/depends.txt b/depends.txt index caa17de..6efe4bb 100644 --- a/depends.txt +++ b/depends.txt @@ -3,3 +3,4 @@ sfinv? 3d_armor? skinsdb? doc_items? +unifieddyes? diff --git a/pages/crafting.lua b/pages/crafting.lua index 64bb5c1..de79585 100644 --- a/pages/crafting.lua +++ b/pages/crafting.lua @@ -157,7 +157,7 @@ local function update_group_selection(state, rebuild) if state.param.crafting_group_list[sel_id] then state.param.crafting_craftable_list = grouped[state.param.crafting_group_list[sel_id]].items table.sort(state.param.crafting_craftable_list, function(a,b) - return a.item < b.item + return a.sort_value < b.sort_value end) grid:setList(state.param.crafting_craftable_list) label:setText(groups_sel:getSelectedItem()) diff --git a/pages/creative.lua b/pages/creative.lua index b00b701..3dc5d50 100644 --- a/pages/creative.lua +++ b/pages/creative.lua @@ -65,7 +65,7 @@ local function update_group_selection(state, changed_group) -- update grid list if outlist then table.sort(outlist, function(a,b) - return a.item < b.item + return a.sort_value < b.sort_value end) grid:setList(outlist) state.param.creative_outlist = outlist diff --git a/ui_tools.lua b/ui_tools.lua index a092b6b..aa65ed8 100644 --- a/ui_tools.lua +++ b/ui_tools.lua @@ -432,6 +432,17 @@ function ui_tools.get_list_grouped(itemtable) end +local function unifieddyes_getpaletteidx() end +if minetest.global_exists("unifieddyes") then + function unifieddyes_getpaletteidx(entry) + local ret = unifieddyes.getpaletteidx(entry.item, "extended") + if ret then + local ret2= string.format("%02X", ret) + return 'dye '..ret2 + end + end +end + ----------------------------------------------------- -- Prepare root lists for all users ----------------------------------------------------- @@ -449,6 +460,9 @@ local function prepare_root_lists() item = itemname, is_button = true } + + entry.sort_value = unifieddyes_getpaletteidx(entry) or itemname + if cache.citems[itemname].cgroups["shape"] then table.insert(ui_tools.root_list_shape, entry) else