Skip to content

API Client

MKI edited this page Oct 17, 2026 · 2 revisions

Client API – PartyLinkClientApi

com.mki.partylink.api.client.PartyLinkClientApi (since API 2). Use it only from client code (on Fabric: your client entrypoint / client source set; on Forge/NeoForge: behind a Dist.CLIENT check). Call it on the client/render thread.

The data comes from the server's party sync (about once per second), so it is empty on servers without PartyLink or when the player hid the HUD with /party hud off.

Queries

Method Returns
isPartyLinkServer() boolean – the connected server runs a compatible PartyLink
isInParty() boolean
getMembers() List<ClientPartyMember> – includes the local player
getMember(UUID) Optional<ClientPartyMember>
isPartyMember(UUID) boolean
getPartyName() String ("" if unnamed)
isPartyPublic() boolean
getMaxPartySize() int
getActivePings() List<PartyPing> – markers currently shown

ClientPartyMember is a record: uuid, name, online, health, maxHealth, level, distance (blocks, -1 if unknown), role (PartyRole), plus isOwner().

Actions

Method Description
requestPing(PartyPingType) Ping where the local player looks, like pressing the ping key

Events

Event Callback
PARTY_UPDATED onPartyUpdated() – after every sync from the server
PING_RECEIVED onPingReceived(PartyPing ping) – also death markers
PartyLinkClientApi.PING_RECEIVED.register(ping -> {
    if (ping.type() == PartyPingType.DANGER) {
        MyMinimap.addWaypoint(ping.x(), ping.y(), ping.z(), 0xFF4D5E);
    }
});

Extra HUD lines

registerHudLineProvider(PartyHudLineProvider) adds a line below a member in the party HUD. The provider is called every frame for every member, so keep it cheap. Return null for "no line". Each member shows at most two extra lines (from the first providers that return one). Long lines are shortened, colors and styles of the Component are kept.

PartyLinkClientApi.registerHudLineProvider(member -> {
    Integer mana = MyManaCache.get(member.uuid());
    return mana == null ? null
            : Component.literal("Mana " + mana).withStyle(ChatFormatting.AQUA);
});

The values you show must come from your own sync – PartyLink only sends its own member data.

Clone this wiki locally