From 8e006930be6fa6b5e60201c92d1c0393448ca606 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Thu, 13 Aug 2026 21:15:49 +0200 Subject: [PATCH] add some native bedrock scoreboard features --- v0.1/player.wit | 25 +++++++++++++++++++++++++ v0.1/plugin.wit | 2 ++ v0.1/scoreboard.wit | 29 +++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/v0.1/player.wit b/v0.1/player.wit index 9a906a1..4891c24 100644 --- a/v0.1/player.wit +++ b/v0.1/player.wit @@ -12,6 +12,7 @@ interface player { use bedrock-packets.{clientbound-packet as bedrock-packet}; use uuid.{uuid}; use status-effect.{status-effect-type, status-effect-instance}; + use scoreboard.{scoreboard, bedrock-scoreboard}; /// Represents per-player weather condition overrides. enum player-weather { @@ -818,6 +819,18 @@ interface player { show-player: func(other: player); /// Checks if this player can see another specified player. can-see: func(other: player) -> bool; + /// Checks if this player can see another specified player. + can-see-player: func(other: player) -> bool; + + /// Sets the tab list ping / latency indicator in milliseconds. + set-tab-list-ping: func(latency-ms: s32); + + /// Sets a client-side item cooldown overlay. + set-item-cooldown: func(item-id: string, ticks: s32); + /// Returns the remaining cooldown ticks for an item, if active. + get-item-cooldown: func(item-id: string) -> option; + /// Checks if an item is currently on cooldown. + has-item-cooldown: func(item-id: string) -> bool; /// Raycasts from the player's eyes to find the block being targeted. get-target-block: func(max-distance: u32) -> option; @@ -862,6 +875,12 @@ interface player { /// Clears any currently shown dialog for the player. clear-dialog: func(); + + /// Returns the Java scoreboard handle for this player. + get-scoreboard: func() -> scoreboard; + + /// Resets the player's custom Java scoreboard back to the world scoreboard. + reset-scoreboard: func(); } /// A handle to a player connected via the Bedrock Edition. @@ -894,6 +913,12 @@ interface player { /// Opens a Bedrock custom form for the player. open-form: func(form: form) -> u32; + + /// Returns the Bedrock scoreboard handle for this player. + get-scoreboard: func() -> bedrock-scoreboard; + + /// Resets the player's custom Bedrock scoreboard back to the world scoreboard. + reset-scoreboard: func(); } /// Returns a list of all players in a specific world. diff --git a/v0.1/plugin.wit b/v0.1/plugin.wit index badf946..644685f 100644 --- a/v0.1/plugin.wit +++ b/v0.1/plugin.wit @@ -45,6 +45,8 @@ world plugin { import status-effect; // Provides 1 : 1 inter-plugin communication import ipc; + /// Provides player management. + import player; // --- Plugin-provided exports --- diff --git a/v0.1/scoreboard.wit b/v0.1/scoreboard.wit index a77f207..7cba1b0 100644 --- a/v0.1/scoreboard.wit +++ b/v0.1/scoreboard.wit @@ -56,11 +56,15 @@ interface scoreboard { resource scoreboard { add-objective: func(name: string, display-name: text-component, render-type: render-type); + update-objective: func(name: string, display-name: text-component, render-type: render-type); remove-objective: func(name: string); set-display-slot: func(slot: display-slot, objective-name: string); + clear-display-slot: func(slot: display-slot); update-score: func(entity-name: string, objective-name: string, value: s32); + add-score: func(entity-name: string, objective-name: string, delta: s32) -> s32; remove-score: func(entity-name: string, objective-name: string); + reset-entity-scores: func(entity-name: string); create-team: func(name: string, settings: team-settings); remove-team: func(name: string); @@ -68,5 +72,30 @@ interface scoreboard { add-player-to-team: func(team-name: string, player-name: string); remove-player-from-team: func(team-name: string, player-name: string); + clear-team-players: func(team-name: string); + } + + enum bedrock-sort-order { + ascending, + descending + } + + enum bedrock-display-slot { + player-list, + sidebar, + below-name + } + + resource bedrock-scoreboard { + add-objective: func(name: string, display-name: string, sort-order: bedrock-sort-order); + update-objective: func(name: string, display-name: string, sort-order: bedrock-sort-order); + remove-objective: func(name: string); + set-display-slot: func(slot: bedrock-display-slot, objective-name: string); + clear-display-slot: func(slot: bedrock-display-slot); + + update-score: func(entity-name: string, objective-name: string, value: s32); + add-score: func(entity-name: string, objective-name: string, delta: s32) -> s32; + remove-score: func(entity-name: string, objective-name: string); + reset-entity-scores: func(entity-name: string); } }