From 44ee9cde86021e287ba59026783b3bd945a4076c Mon Sep 17 00:00:00 2001 From: Brandon Date: Sun, 28 Jun 2020 09:38:06 -0400 Subject: [PATCH] Add potions/brewing to creative inventory --- mods/HUD/mcl_inventory/creative.lua | 56 +++++++++++++--------------- mods/HUD/mcl_inventory/depends.txt | 2 + mods/ITEMS/mcl_brewing/init.lua | 16 ++++---- mods/ITEMS/mcl_potions/lingering.lua | 1 + mods/ITEMS/mcl_potions/splash.lua | 1 + 5 files changed, 37 insertions(+), 39 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 0b5f52b6b2..8fe745804d 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -10,10 +10,8 @@ local inventory_lists = {} local show_armor = minetest.get_modpath("mcl_armor") ~= nil local mod_player = minetest.get_modpath("mcl_player") ~= nil --- TODO: Brewing is disabled. Add brewing (uncommented code) when it is implemented properly - -- Create tables -local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs",--[["brew",]]"matr","misc","all"} +local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"} for _, f in pairs(builtin_filter_ids) do inventory_lists[f] = {} end @@ -67,11 +65,10 @@ do table.insert(inventory_lists["mobs"], name) nonmisc = true end - -- TODO: add brew - --if def.groups.brewitem then - --table.insert(inventory_lists["brew"], name) - --nonmisc = true - --end + if def.groups.brewitem then + table.insert(inventory_lists["brew"], name) + nonmisc = true + end if def.groups.craftitem then table.insert(inventory_lists["matr"], name) nonmisc = true @@ -160,7 +157,7 @@ trash:set_size("main", 1) local noffset = {} -- numeric tab offset local offset = {} -- string offset: -local boffset = {} -- +local boffset = {} -- local hoch = {} local filtername = {} local bg = {} @@ -182,6 +179,7 @@ next_noffset("blocks") next_noffset("deco") next_noffset("redstone") next_noffset("rail") +next_noffset("brew") next_noffset("misc") next_noffset("nix", true) @@ -193,7 +191,6 @@ next_noffset("food") next_noffset("tools") next_noffset("combat") next_noffset("mobs") ---next_noffset("brew") -- TODO: add brew next_noffset("matr") next_noffset("inv", true) @@ -206,6 +203,7 @@ hoch["blocks"] = "" hoch["deco"] = "" hoch["redstone"] = "" hoch["rail"] = "" +hoch["brew"] = "" hoch["misc"] = "" hoch["nix"] = "" hoch["default"] = "" @@ -213,7 +211,6 @@ hoch["food"] = "_down" hoch["tools"] = "_down" hoch["combat"] = "_down" hoch["mobs"] = "_down" ---hoch["brew"] = "_down" -- TODO: add brew hoch["matr"] = "_down" hoch["inv"] = "_down" @@ -228,26 +225,26 @@ filtername["food"] = S("Foodstuffs") filtername["tools"] = S("Tools") filtername["combat"] = S("Combat") filtername["mobs"] = S("Mobs") ---filtername["brew"] = S("Brewing") -- TODO: add brew +filtername["brew"] = S("Brewing") filtername["matr"] = S("Materials") filtername["inv"] = S("Survival Inventory") local dark_bg = "crafting_creative_bg_dark.png" local function reset_menu_item_bg() - bg["blocks"] = dark_bg - bg["deco"] = dark_bg - bg["redstone"] = dark_bg - bg["rail"] = dark_bg - bg["misc"] = dark_bg - bg["nix"] = dark_bg - bg["food"] = dark_bg - bg["tools"] = dark_bg - bg["combat"] = dark_bg + bg["blocks"] = dark_bg + bg["deco"] = dark_bg + bg["redstone"] = dark_bg + bg["rail"] = dark_bg + bg["misc"] = dark_bg + bg["nix"] = dark_bg + bg["food"] = dark_bg + bg["tools"] = dark_bg + bg["combat"] = dark_bg bg["mobs"] = dark_bg - --bg["brew"] = dark_bg -- TODO: add brew - bg["matr"] = dark_bg - bg["inv"] = dark_bg + bg["brew"] = dark_bg + bg["matr"] = dark_bg + bg["inv"] = dark_bg bg["default"] = dark_bg end @@ -377,7 +374,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz tools = "mcl_core:axe_iron", combat = "mcl_core:sword_gold", mobs = "mobs_mc:cow", - brew = "mcl_potions:potion_water", + brew = "mcl_potions:water", matr = "mcl_core:stick", inv = "mcl_chests:chest", } @@ -388,7 +385,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz else bg_img = "crafting_creative_inactive"..hoch[this_tab]..".png" end - return + return "style["..this_tab..";border=false;bgimg=;bgimg_pressed=]".. "item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]".. "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" .. @@ -428,9 +425,8 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz "tooltip[combat;"..F(filtername["combat"]).."]".. tab(name, "mobs") .. "tooltip[mobs;"..F(filtername["mobs"]).."]".. - -- TODO: Add brew - --tab(name, "brew") .. - --"tooltip[brew;"..F(filtername["brew"]).."]".. + tab(name, "brew") .. + "tooltip[brew;"..F(filtername["brew"]).."]".. tab(name, "matr") .. "tooltip[matr;"..F(filtername["matr"]).."]".. tab(name, "inv") .. @@ -504,12 +500,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if players[name].page == "mobs" then return end set_inv_page("mobs",player) page = "mobs" - --[[ TODO: add brew elseif fields.brew then if players[name].page == "brew" then return end set_inv_page("brew",player) page = "brew" - ]] elseif fields.matr then if players[name].page == "matr" then return end set_inv_page("matr",player) diff --git a/mods/HUD/mcl_inventory/depends.txt b/mods/HUD/mcl_inventory/depends.txt index fb454b7d11..cf04c75efd 100644 --- a/mods/HUD/mcl_inventory/depends.txt +++ b/mods/HUD/mcl_inventory/depends.txt @@ -3,3 +3,5 @@ mcl_formspec mcl_player? _mcl_autogroup? mcl_armor? +mcl_brewing? +mcl_potions? diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 6234e5badb..7d0319d6db 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -384,7 +384,7 @@ minetest.register_node("mcl_brewing:stand_000", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 0, not_in_craft_guide = 0}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 0, not_in_craft_guide = 0}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -469,7 +469,7 @@ minetest.register_node("mcl_brewing:stand_100", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -553,7 +553,7 @@ minetest.register_node("mcl_brewing:stand_010", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -637,7 +637,7 @@ minetest.register_node("mcl_brewing:stand_001", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -721,7 +721,7 @@ minetest.register_node("mcl_brewing:stand_110", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -805,7 +805,7 @@ minetest.register_node("mcl_brewing:stand_101", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -889,7 +889,7 @@ minetest.register_node("mcl_brewing:stand_011", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", @@ -973,7 +973,7 @@ minetest.register_node("mcl_brewing:stand_111", { _doc_items_longdesc = S("The stand allows you to brew potions!"), _doc_items_usagehelp = doc_string, _tt_help = S("Brew Potions"), - groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, + groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1}, tiles = tiles, drop = "mcl_brewing:stand", paramtype = "light", diff --git a/mods/ITEMS/mcl_potions/lingering.lua b/mods/ITEMS/mcl_potions/lingering.lua index fb837d213a..cbafe905d7 100644 --- a/mods/ITEMS/mcl_potions/lingering.lua +++ b/mods/ITEMS/mcl_potions/lingering.lua @@ -70,6 +70,7 @@ local function register_lingering(name, descr, color, def) minetest.register_craftitem(id, { description = descr, inventory_image = lingering_image(color), + groups = {brewitem=1, not_in_creative_inventory=0}, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir(); diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index 05d1a66aec..a157943ce8 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -12,6 +12,7 @@ local function register_splash(name, descr, color, def) minetest.register_craftitem(id, { description = descr, inventory_image = splash_image(color), + groups = {brewitem=1, not_in_creative_inventory=0}, on_use = function(item, placer, pointed_thing) local velocity = 10 local dir = placer:get_look_dir();