I have 12 new blocks (end of the day) so to finish up i checked everything was in place but noticed that the objects display in the inventory (creative) but not in an order I can see how to re-arrange. They are not showing in Alphabetical order or by date/hour of creation. I have checked the 3Dmodels.obj files but using a simple text editor and I can't see anything in there concerning name etc that could effect the display order.
My .lua file has them in the order I would like them to be read and displayed by MT but that doesn't seem to be the way it works.
Sure I have ducked :D around by can't find anything that seems to be related.
Is there anything I can do to get the inventory to show my nodes in the order I want them to?
cheers
[FORGET IT, Don't waste your time] Organizing the Inventory?
- Steamed_Punk
- Member
- Posts: 156
- Joined: Sat Aug 10, 2019 13:31
- GitHub: steamed-punk
[FORGET IT, Don't waste your time] Organizing the Inventory?
Last edited by Steamed_Punk on Fri Oct 09, 2020 11:44, edited 3 times in total.
The sky is not the limit - It's my playground
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: Organizing the Inventory?
Here a simple approach to sort the inventory items in alphabetical order by means of the chat command "/sort":
Code: Select all
minetest.register_chatcommand("sort", {
description = "Sort the player inventory in alphabetical order",
func = function(name, param)
local inv = minetest.get_inventory({type="player", name=name})
local list = inv:get_list("main")
table.sort(list, function (a, b)
local name_a = a:get_name()
local name_b = b:get_name()
if name_a == "" and name_b ~= "" then return false end
if name_a ~= "" and name_b == "" then return true end
return string.lower(name_a) < string.lower(name_b)
end)
inv:set_list("main", list)
end
})
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
- Steamed_Punk
- Member
- Posts: 156
- Joined: Sat Aug 10, 2019 13:31
- GitHub: steamed-punk
Re: Organizing the Inventory?
Thanks for that it's pretty cool. But I guess I didn't explain myself correctly. It's not what the player has in his personal inventory I want to organize, but what displays in creative when all the blocks are displayed. I am not trying to re-organize everything, just my blocks.joe7575 wrote: ↑Fri Oct 09, 2020 07:48Here a simple approach to sort the inventory items in alphabetical order by means of the chat command "/sort":
Code: Select all
minetest.register_chatcommand("sort", { description = "Sort the player inventory in alphabetical order", func = function(name, param) local inv = minetest.get_inventory({type="player", name=name}) local list = inv:get_list("main") table.sort(list, function (a, b) local name_a = a:get_name() local name_b = b:get_name() if name_a == "" and name_b ~= "" then return false end if name_a ~= "" and name_b == "" then return true end return string.lower(name_a) < string.lower(name_b) end) inv:set_list("main", list) end })
for example:
A full node, three_quarter node, half node and a quarter node (heights). All aligned in that order.
The sky is not the limit - It's my playground
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: Organizing the Inventory?
You can use the creative mod to create custom tabs. Also, the order in the creative inventory will probably be alphabetical based on item name or based on registration order, I forget
- Steamed_Punk
- Member
- Posts: 156
- Joined: Sat Aug 10, 2019 13:31
- GitHub: steamed-punk
Re: Organizing the Inventory?
I had read somewhere about tabs, and forgot, I will dig into that it looks like it could be a good solution.rubenwardy wrote: ↑Fri Oct 09, 2020 09:54You can use the creative mod to create custom tabs. Also, the order in the creative inventory will probably be alphabetical based on item name or based on registration order, I forget
Thanks
The sky is not the limit - It's my playground
- Steamed_Punk
- Member
- Posts: 156
- Joined: Sat Aug 10, 2019 13:31
- GitHub: steamed-punk
Re: Organizing the Inventory?
Never mind I will stick to just modelling and texturing and just throw stuff at Minetest the best way I can.
@rubenwardy I have tried your modding book but can't make head nor tail of it.
https://rubenwardy.com/minetest_modding ... sfinv.html
I managed to add a new tab and change it's name and apart from showing hello world in the example I am lost.
I have also tried rebuilding and renaming the models in the correct order. Nothing, MT just throws them in there without any order 'Alphabetic or other'.
I took a look at the inventory.lua in the creative mod to get some idea. I am just wasting creative time again. Obviously I am wasting other peoples time as well.
@rubenwardy I have tried your modding book but can't make head nor tail of it.
https://rubenwardy.com/minetest_modding ... sfinv.html
I managed to add a new tab and change it's name and apart from showing hello world in the example I am lost.
I have also tried rebuilding and renaming the models in the correct order. Nothing, MT just throws them in there without any order 'Alphabetic or other'.
I took a look at the inventory.lua in the creative mod to get some idea. I am just wasting creative time again. Obviously I am wasting other peoples time as well.
The sky is not the limit - It's my playground
Who is online
Users browsing this forum: No registered users and 18 guests