Repository navigation
API Client
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 stopped the sync with /party hud off. Hiding the HUD in the HUD settings does not empty it.
| 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().
| Method | Description |
|---|---|
requestPing(PartyPingType) |
Ping where the local player looks, like pressing the ping key |
| 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);
}
});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.
PartyLink 2.0 adds methods to work together with the party HUD:
| Method | Description |
|---|---|
setHudSuppressed(String key, boolean suppressed) |
Hide the party HUD while at least one key suppresses it, e.g. during a cutscene or while your own full-screen overlay is open. Use a unique key (your mod id) and call it again with false to show the HUD. Ping markers stay visible |
isHudSuppressed() |
boolean – any mod currently suppresses the HUD |
isHudEnabled() |
boolean – the player turned the HUD on in the HUD settings
|
getHudBounds() |
Optional<PartyHudBounds> – where the HUD was drawn in the last frame, in GUI-scaled pixels. Empty when it was not drawn (no party, hidden, suppressed, F1) |
getHudAccentColor() |
int – the player's HUD accent color as 0xRRGGBB, so your add-on can match the design |
PartyHudBounds is a record: x, y, width, height, plus contains(double x, double y).
// Keep your own HUD element away from the party HUD
PartyLinkClientApi.getHudBounds().ifPresent(bounds -> {
if (bounds.contains(myX, myY)) {
myY = bounds.y() + bounds.height() + 4;
}
});
// Hide the party HUD while your boss intro plays
PartyLinkClientApi.setHudSuppressed("mymod", true);
// ... later
PartyLinkClientApi.setHudSuppressed("mymod", false);Check PartyLinkApi.API_VERSION >= 3 before calling these methods if your mod also supports PartyLink 1.2.
PartyLink by MKI · Documentation for version 2.0.0 · Changelog
Players
Server owners
Developers