mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
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.
23 lines
728 B
Lua
23 lines
728 B
Lua
local M = {}
|
|
|
|
function M.share_default_func(invid, slotid)
|
|
local blockinv = hud.get_block_inventory()
|
|
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)
|
|
else
|
|
inventory.move(invid, slotid, blockinv)
|
|
end
|
|
elseif rules.get("allow-content-access") then
|
|
inventory.set(invid, slotid, 0, 0)
|
|
elseif slotid < hotbar_size then
|
|
inventory.move_range(invid, slotid, invid, hotbar_size)
|
|
else
|
|
inventory.move_range(invid, slotid, invid, 0, hotbar_size - 1)
|
|
end
|
|
end
|
|
|
|
return M
|