Merge pull request #1043 from ostermine/feat/hotbar-control

make hotbar size and layout configurable
This commit is contained in:
MihailRis 2026-10-18 11:38:10 +03:00 • committed by GitHub
commit bb73e3f354
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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