Add mobs page in creative inventory

This commit is contained in:
Wuzzy 2019-02-06 11:31:04 +01:00
parent 27fa2c2e66
commit 069f3591e2
2 changed files with 15 additions and 1 deletions

View File

@ -7,7 +7,7 @@ local inventory_lists = {}
-- TODO: Brewing is disabled. Add brewing (uncommented code) when it is implemented properly -- TODO: Brewing is disabled. Add brewing (uncommented code) when it is implemented properly
-- Create tables -- Create tables
local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat",--[["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 for _, f in pairs(builtin_filter_ids) do
inventory_lists[f] = {} inventory_lists[f] = {}
end end
@ -57,6 +57,10 @@ do
table.insert(inventory_lists["combat"], name) table.insert(inventory_lists["combat"], name)
nonmisc = true nonmisc = true
end end
if def.groups.spawn_egg == 1 then
table.insert(inventory_lists["mobs"], name)
nonmisc = true
end
-- TODO: add brew -- TODO: add brew
--if def.groups.brewitem then --if def.groups.brewitem then
--table.insert(inventory_lists["brew"], name) --table.insert(inventory_lists["brew"], name)
@ -181,6 +185,7 @@ noffset_y = 8.12
next_noffset("food") next_noffset("food")
next_noffset("tools") next_noffset("tools")
next_noffset("combat") next_noffset("combat")
next_noffset("mobs")
--next_noffset("brew") -- TODO: add brew --next_noffset("brew") -- TODO: add brew
next_noffset("matr") next_noffset("matr")
next_noffset("inv", true) next_noffset("inv", true)
@ -200,6 +205,7 @@ hoch["default"] = ""
hoch["food"] = "^[transformfy" hoch["food"] = "^[transformfy"
hoch["tools"] = "^[transformfy" hoch["tools"] = "^[transformfy"
hoch["combat"] = "^[transformfy" hoch["combat"] = "^[transformfy"
hoch["mobs"] = "^[transformfy"
--hoch["brew"] = "^[transformfy" -- TODO: add brew --hoch["brew"] = "^[transformfy" -- TODO: add brew
hoch["matr"] = "^[transformfy" hoch["matr"] = "^[transformfy"
hoch["inv"] = "^[transformfy" hoch["inv"] = "^[transformfy"
@ -216,6 +222,7 @@ local function reset_menu_item_bg()
bg["food"] = dark_bg bg["food"] = dark_bg
bg["tools"] = dark_bg bg["tools"] = dark_bg
bg["combat"] = dark_bg bg["combat"] = dark_bg
bg["mobs"] = dark_bg
--bg["brew"] = dark_bg -- TODO: add brew --bg["brew"] = dark_bg -- TODO: add brew
bg["matr"] = dark_bg bg["matr"] = dark_bg
bg["inv"] = dark_bg bg["inv"] = dark_bg
@ -337,6 +344,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
food = "mcl_core:apple", food = "mcl_core:apple",
tools = "mcl_core:axe_iron", tools = "mcl_core:axe_iron",
combat = "mcl_core:sword_gold", combat = "mcl_core:sword_gold",
mobs = "mobs_mc:cow",
brew = "mcl_potions:potion_water", brew = "mcl_potions:potion_water",
matr = "mcl_core:stick", matr = "mcl_core:stick",
inv = "mcl_chests:chest", inv = "mcl_chests:chest",
@ -383,6 +391,8 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
"tooltip[tools;Tools]".. "tooltip[tools;Tools]"..
tab(name, "combat") .. tab(name, "combat") ..
"tooltip[combat;Combat]".. "tooltip[combat;Combat]"..
tab(name, "mobs") ..
"tooltip[mobs;Mobs]"..
-- TODO: Add brew -- TODO: Add brew
--tab(name, "brew") .. --tab(name, "brew") ..
--"tooltip[brew;Brewing]".. --"tooltip[brew;Brewing]"..
@ -454,6 +464,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if players[name].page == "combat" then return end if players[name].page == "combat" then return end
set_inv_page("combat",player) set_inv_page("combat",player)
page = "combat" page = "combat"
elseif fields.mobs then
if players[name].page == "mobs" then return end
set_inv_page("mobs",player)
page = "mobs"
--[[ TODO: add brew --[[ TODO: add brew
elseif fields.brew then elseif fields.brew then
if players[name].page == "brew" then return end if players[name].page == "brew" then return end

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B