add player icon to ar

This commit is contained in:
LordMZTE 2021-11-14 16:29:31 +01:00
parent 084b971e15
commit 5e524f14ac

View file

@ -13,7 +13,7 @@ local function draw_idx_string(string, x)
if x ~= nil then if x ~= nil then
x_or_default = x x_or_default = x
end end
return function() return function()
ar.drawString(string, x_or_default, 10 * cur_row, 0xffffff) ar.drawString(string, x_or_default, 10 * cur_row, 0xffffff)
cur_row = cur_row + 1 cur_row = cur_row + 1
@ -27,15 +27,21 @@ local function draw_idx_separator()
end end
end end
while true do local function draw_one_line_idx_icon(name)
local draws = {} return function()
ar.drawItemIcon(name, 0, 10 * cur_row)
cur_row = cur_row + 1
end
end
table.insert(draws, function() while true do
ar.drawItemIcon("minecraft:clock", 0, 0) local draws = {
end) draw_one_line_idx_icon "minecraft:clock",
table.insert(draws, draw_idx_string(os.date(), 20)) draw_idx_string(os.date(), 20),
table.insert(draws, draw_idx_separator()) draw_idx_separator(),
table.insert(draws, draw_idx_string("Players:")) draw_one_line_idx_icon "minecraft:player_head",
draw_idx_string("Players:", 20),
}
for _, p in pairs(pl_detector.getOnlinePlayers()) do for _, p in pairs(pl_detector.getOnlinePlayers()) do
local pos = pl_detector.getPlayerPos(p) local pos = pl_detector.getPlayerPos(p)