Scoreboards

Wraps Minecraft scoreboards with objective management and per-entity score operations.

This split between objective handles and per-entity score handles maps well to how vanilla scoreboards already work, but with a more readable API.

Objectives

function("scoreboard_setup") {
	scoreboard("kills") {
		create()
		setDisplaySlot(DisplaySlots.sidebar)
		setDisplayName("Kill Count")
	}
}
Kotlin
Function Description
create Create the objective
remove Remove the objective
setDisplaySlot Assign a display slot
setDisplayName Set the display name
setRenderType Set the render type

Practical pattern

function("match_setup") {
	val kills = scoreboard("kills")
	kills.create()
	kills.setDisplaySlot(DisplaySlots.sidebar)

	val playerKills = player.getScoreEntity("kills")
	playerKills.set(0)
}
Kotlin

The usual pattern is to configure the objective once, then retrieve entity-specific score handles wherever gameplay code needs to increment, reset, or copy values.

Per-entity scores

function("score_ops") {
	val score = player.getScoreEntity("kills")
	score.set(10)
	score.add(5)
	score.remove(2)
	score.reset()
	score.copyFrom(player.asSelector(), "deaths")
}
Kotlin
Function Description
set Set score to a value
add Add to the score
remove Subtract from the score
reset Reset the score
copyTo Copy this score to another holder/objective
copyFrom Copy from another holder/objective