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

@ -2,7 +2,9 @@ local M = {}
function M.share_default_func(invid, slotid)
local blockinv = hud.get_block_inventory()
local playerinv = player.get_inventory(hud.get_player())
local pid = hud.get_player()
local playerinv = player.get_inventory(pid)
local hotbar_size = player.get_hotbar_size(pid)
if blockinv ~= 0 then
if invid == blockinv then
inventory.move(blockinv, slotid, playerinv)
@ -11,10 +13,10 @@ function M.share_default_func(invid, slotid)
end
elseif rules.get("allow-content-access") then
inventory.set(invid, slotid, 0, 0)
elseif slotid < 10 then
inventory.move_range(invid, slotid, invid, 10)
elseif slotid < hotbar_size then
inventory.move_range(invid, slotid, invid, hotbar_size)
else
inventory.move_range(invid, slotid, invid, 0, 9)
inventory.move_range(invid, slotid, invid, 0, hotbar_size - 1)
end
end