Creative inventory using new potions API

-creative inventory utilizes the new potions API
-the new fancy tooltips are used there
This commit is contained in:
the-real-herowl 2023-10-27 05:09:37 +02:00
parent ef2ce7e0d7
commit 6d927ab1a1
2 changed files with 23 additions and 2 deletions

View File

@ -105,7 +105,13 @@ minetest.register_on_mods_loaded(function()
nonmisc = true nonmisc = true
end end
if def.groups.brewitem then if def.groups.brewitem then
table.insert(inventory_lists["brew"], name) local str = name
if def.groups._mcl_potion == 1 then
local stack = ItemStack(name)
tt.reload_itemstack_description(stack)
str = stack:to_string()
end
table.insert(inventory_lists["brew"], str)
nonmisc = true nonmisc = true
end end
if def.groups.craftitem then if def.groups.craftitem then
@ -117,6 +123,21 @@ minetest.register_on_mods_loaded(function()
table.insert(inventory_lists["misc"], name) table.insert(inventory_lists["misc"], name)
end end
if def.groups._mcl_potion == 1 then
if def.has_potent then
local stack = ItemStack(name)
stack:get_meta():set_int("mcl_potions:potion_potent", 1)
tt.reload_itemstack_description(stack)
table.insert(inventory_lists["brew"], stack:to_string())
end
if def.has_plus then
local stack = ItemStack(name)
stack:get_meta():set_int("mcl_potions:potion_plus", 1)
tt.reload_itemstack_description(stack)
table.insert(inventory_lists["brew"], stack:to_string())
end
end
table.insert(inventory_lists["all"], name) table.insert(inventory_lists["all"], name)
end end
end end

View File

@ -2,4 +2,4 @@ name = mcl_inventory
author = BlockMen author = BlockMen
description = Adds the player inventory and creative inventory. description = Adds the player inventory and creative inventory.
depends = mcl_init, mcl_formspec, mcl_enchanting, mcl_gamemode depends = mcl_init, mcl_formspec, mcl_enchanting, mcl_gamemode
optional_depends = mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide, mcl_player optional_depends = mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide, mcl_player, tt