Player: create PlayerInventoryUI class & change item count in hotbar (8->9). #34

This commit is contained in:
Van
2026-03-12 21:43:33 +03:00
parent e359c4be09
commit 145f65d4af
4 changed files with 66 additions and 1 deletions

View File

@@ -1,4 +1,23 @@
---@class Player
local Player = {}
return Player
---@type PlayerInventoryUI
local PlayerInventoryUI = Mod.getInfo('smc__ui__player_inventory').require('PlayerInventoryUI')
core.register_on_joinplayer(function(player)
player:set_inventory_formspec(PlayerInventoryUI:getFormSpecString(player:get_player_name()))
player:hud_set_hotbar_itemcount(9)
local inv = player:get_inventory()
inv:set_size('main', 18)
end)
core.register_chatcommand('show_inv',
{
func = function(name, param)
PlayerInventoryUI:showForm(name)
return true
end
}
)
return Player