From da64a1040301ac51a6c7bfd62f55fed118435b00 Mon Sep 17 00:00:00 2001 From: Michieal Date: Sat, 26 Nov 2022 04:28:07 +0100 Subject: [PATCH] mcl_info: Add player coords field to debug hud --- mods/HUD/mcl_info/init.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/mods/HUD/mcl_info/init.lua b/mods/HUD/mcl_info/init.lua index 8c93c14204..9cb2ddd05b 100644 --- a/mods/HUD/mcl_info/init.lua +++ b/mods/HUD/mcl_info/init.lua @@ -153,9 +153,28 @@ mcl_info.register_debug_field("Biome",{ return "No biome" end }) -mcl_info.register_debug_field("Coords",{ - level = 2, - func = function(pl,pos) - return format("x:%.1f y:%.1f z:%.1f", pos.x, pos.y, pos.z) + +mcl_info.register_debug_field("Coords", { + func = function(pl, pos) + local report_y = 0 + -- overworld + if (pos.y >= mcl_vars.mg_overworld_min) and (pos.y <= mcl_vars.mg_overworld_max) then + return format("Overworld: x:%.1f y:%.1f z:%.1f", pos.x, pos.y, pos.z) + end + + -- nether + if (pos.y >= mcl_vars.mg_nether_min) and (pos.y <= mcl_vars.mg_nether_max) then + report_y = pos.y - mcl_vars.mg_nether_min + return format("Nether: x:%.1f y:%.1f z:%.1f", pos.x, report_y, pos.z) + end + + -- end + if (pos.y >= mcl_vars.mg_end_min) and (pos.y <= mcl_vars.mg_end_max) then + report_y = pos.y - mcl_vars.mg_end_min + return format("End: x:%.1f y:%.1f z:%.1f", pos.x, report_y, pos.z) + end + + return format("Void: x:%.1f y:%.1f z:%.1f", pos.x, pos.y, pos.z) + end })