Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PrinceOfCookies/CookieOS/llms.txt

Use this file to discover all available pages before exploring further.

Player Tracker is a CookieOS program that continuously polls every online player’s position and health, then renders the results onto an attached monitor peripheral. Players are automatically separated into Overworld and Nether columns so you can see at a glance where everyone is and how much health they have — updated every 5 seconds.

Prerequisites

All three of the following peripherals must be attached to the computer. If any one is missing, the “Player Tracker” entry in the Programs menu is shown in red text and the program exits immediately at startup.
PeripheralPurpose
chatBoxRequired by the tracker to send fallback error messages when a player’s position cannot be retrieved
monitorThe external display where coordinates are rendered
playerDetectorQueries online players and returns real-time position, health, and dimension data
The playerDetector peripheral is provided by the AdvancedPeripherals mod, and chatBox is provided by the ChatBoxes mod (also known as Advanced Chat). Both mods must be installed on the server for Player Tracker to function. Neither is part of the base CC:Tweaked installation.

Monitor Layout

When the program starts, monitor.setTextScale(0.5) is called to maximise information density. The display is then structured as follows:
              Overworld
 Player Alice(20) is at coordinates: 142, 64, -88
 Player Bob(14) is at coordinates: -300, 71, 204

              Nether
 Player Carol(18) is at coordinates: 17, 45, -11
  • The “Overworld” header is centred horizontally at row 1.
  • Overworld players are listed starting at row 3, one row each.
  • The “Nether” header is placed below the last Overworld entry (offset by the total online player count + 4 rows).
  • Nether players are listed immediately below the Nether header.
Each player line follows the format:
Player <name>(<health>) is at coordinates: <X>, <Y>, <Z>

Update Interval

The tracker calls sendPlayerCoords() inside a while true loop with os.sleep(5) between iterations, so the monitor is refreshed every 5 seconds. The monitor is fully cleared (monitor.clear()) at the start of each refresh to avoid stale entries from players who have logged off.

Dimension Detection

The playerDetector.getPlayerPos(player) call returns a table that includes a dimension field. The tracker checks this field to route each player to the correct column:
coords.dimension valueColumn
"minecraft:overworld"Overworld section
"minecraft:the_nether"Nether section
Players in any other dimension (e.g. The End) are not currently displayed in a dedicated section.

Core Logic

for _, player in ipairs(playerDetector.getOnlinePlayers()) do
    local coords = playerDetector.getPlayerPos(player)
    local dim = coords.dimension
    local health = coords.health
    if coords then
        local message = string.format(
            "Player %s(%d) is at coordinates: %d, %d, %d",
            player, health, coords.x, coords.y, coords.z
        )
        -- Splits overworld/nether into separate columns
    end
end
If getPlayerPos returns nil for a player (for example, because they are in an unsupported dimension or the mod cannot locate them), a fallback message is sent via the chatBox peripheral:
chatBox.sendMessage(string.format(
    "Could not retrieve coordinates for player %s", player
))
The monitor’s text scale is forced to 0.5 at startup to fit as many players as possible. At this scale, a standard 2×2 monitor is recommended for servers with more than a handful of online players. If the player list exceeds the monitor’s height, entries will overflow off-screen.

Build docs developers (and LLMs) love