Skip to content

@loontail/minecraft-kit v0.8.14 / offlineUuidFor

Function: offlineUuidFor()

ts
function offlineUuidFor(username): PlayerUuid

Derive a stable v3-style UUID for an offline player username.

Mojang's offline-mode formula: MD5("OfflinePlayer:" + name) with the version/variant bits patched to UUID v3.

Parameters

ParameterType
usernamestring

Returns

PlayerUuid

Example

ts
import { AuthModes, offlineUuidFor, type OfflineAuth } from "@loontail/minecraft-kit";

const username = "Notch";
const auth: OfflineAuth = { mode: AuthModes.OFFLINE, username, uuid: offlineUuidFor(username) };
// auth.uuid → "069a79f4-44e9-4726-a5be-fca90e38aaf5"

Source

src/core/uuid.ts:46

MIT License