-
Notifications
You must be signed in to change notification settings - Fork 4
Advancements
Advancements in Kore can be created using the advancement
function. This documentation will show you how to create and customize
advancements.
To create a basic advancement:
dataPack("my_datapack") {
advancement("my_advancement") {
display(Items.DIAMOND_SWORD, "Title", "Description") {
frame = AdvancementFrameType.TASK
}
criteria {
// Define criteria here
}
}
}
You can specify a parent advancement for your advancement. This is done by setting the parent
property to an Advancement
object or an
AdvancementArgument
object. Here's an example:
advancement("my_advancement") {
parent = Advancements.Story.ROOT // Reference to vanilla advancement
// or
parent = AdvancementArgument("custom_advancement", "my_namespace")
}
The display block allows you to customize how the advancement appears in-game:
advancement("my_advancement") {
display(Items.DIAMOND_SWORD) {
icon {
item(Items.DIAMOND_SWORD)
}
title = textComponent("Title")
description = textComponent("Description", Color.GRAY)
frame = AdvancementFrameType.TASK
background = "minecraft:textures/gui/advancements/backgrounds/adventure.png"
showToast = true
announceToChat = true
hidden = false
}
}
-
icon
: The icon of the advancement, defined by anAdvancementIcon
object which is an item + nbt data. -
title
: The title of the advancement, defined by aChatComponents
object. -
description
: The description of the advancement, defined by aChatComponents
object. -
frame
: The frame type of the advancement, which can beCHALLENGE
,GOAL
, orTASK
, defaults toTASK
. -
background
: The background texture of the advancement, specified as a string (optional). -
showToast
: Whether to show a toast notification when the advancement is achieved (optional). -
announceToChat
: Whether to announce the advancement in chat when it is achieved (optional). -
hidden
: Whether the advancement is hidden until it is achieved (optional).
Criteria define the conditions that must be met to earn the advancement.
Each criterion can have predicate conditions that must be met for the criterion to be completed on top of its properties.
You can add multiple criteria:
advancement("my_advancement") {
criteria {
// Simple item consumption
consumeItem("eat_golden_apple") {
item {
item(Items.GOLDEN_APPLE)
}
}
// With conditions
sleptInBed("sleep_in_bed") {
conditions { // Predicates
randomChance(0.8f)
timeCheck(5f..15f)
}
}
}
}
Check the Triggers page for a list of available triggers.
Requirements define which criteria must be completed to earn the advancement:
advancement("my_advancement") {
// Single requirement
requirements("criterion1")
// Multiple requirements (AND)
requirements(listOf("criterion1", "criterion2"))
// Multiple requirement groups (OR between groups)
requirements(
listOf("criterion1", "criterion2"),
listOf("criterion3")
)
}
You can define rewards for completing the advancement:
advancement("my_advancement") {
rewards {
experience = 10
function = function("reward_function") {
say("Congratulations!")
}
loots(LootTables.Chests.IGLOO_CHEST)
recipes(Recipes.SOME_RECIPE)
}
}
-
experience
: The amount of experience to give the player. -
function
: A function to run when the advancement is completed. -
loots
: A list of loot tables to give the player. -
recipes
: A list of recipes to unlock for the player.
You can enable or disable telemetry for the advancement, defaults to false
:
advancement("my_advancement") {
sendsTelemetryEvent = true
}
Here's a complete example combining various features:
advancement("complex_advancement") {
display(Items.DIAMOND_SWORD, "Master Craftsman", "Craft a special item") {
frame = AdvancementFrameType.CHALLENGE
announceToChat = true
}
parent = Advancements.Story.ROOT
criteria {
crafterRecipeCrafted("craft_special", Recipes.SPECIAL_RECIPE) {
ingredient(Items.DIAMOND) {
components {
damage(0)
}
}
}
}
requirements("craft_special")
rewards {
experience = 100
function = function("reward") {
say("Congratulations on becoming a Master Craftsman!")
}
loots(LootTables.Chests.IGLOO_CHEST)
}
sendsTelemetryEvent = false
}
Explore the different pages:
- Home
- Chat Components
- Configuration
- Creating a Datapack
- Functions
- Data-Driven Features:
- Scoreboards
Helpers: