From 0bb9d862e82e6d85c1173284772d14156dae8302 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 27 Oct 2023 05:09:37 +0200 Subject: [PATCH] Creative inventory using new potions API -creative inventory utilizes the new potions API -the new fancy tooltips are used there --- mods/HUD/mcl_inventory/creative.lua | 23 ++++++++++++++++++++++- mods/HUD/mcl_inventory/mod.conf | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 1288bc1d5..95fe7419b 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -105,7 +105,13 @@ minetest.register_on_mods_loaded(function() nonmisc = true end 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 end if def.groups.craftitem then @@ -117,6 +123,21 @@ minetest.register_on_mods_loaded(function() table.insert(inventory_lists["misc"], name) 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) end end diff --git a/mods/HUD/mcl_inventory/mod.conf b/mods/HUD/mcl_inventory/mod.conf index 66f175c3b..fc10fe32a 100644 --- a/mods/HUD/mcl_inventory/mod.conf +++ b/mods/HUD/mcl_inventory/mod.conf @@ -2,4 +2,4 @@ name = mcl_inventory author = BlockMen description = Adds the player inventory and creative inventory. 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