make hotbar size and layout configurable

Add hotbar-size, hotbar-layout and inventory-layout to config/defaults.toml,
player.get_hotbar_size / player.set_hotbar_size and
hud.is_hotbar_visible / hud.set_hotbar_visible.
This commit is contained in:
ostermine 2026-10-15 15:52:22 +03:00
parent 2e2233a489
commit aa670f3c9d
16 changed files with 188 additions and 20 deletions

View file

@ -43,7 +43,8 @@ function on_hud_open()
end
local id = block.get_picking_item(block.get(x, y, z))
local inv, cur_slot = player.get_inventory(pid)
local slot = inventory.find_by_item(inv, id, 0, 9)
local hotbar_size = player.get_hotbar_size(pid)
local slot = inventory.find_by_item(inv, id, 0, hotbar_size)
if slot then
player.set_selected_slot(pid, slot)
return
@ -51,7 +52,7 @@ function on_hud_open()
if not rules.get("allow-content-access") then
return
end
slot = inventory.find_by_item(inv, 0, 0, 9)
slot = inventory.find_by_item(inv, 0, 0, hotbar_size)
if slot then
cur_slot = slot
end