Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Advancement Rewards

GamerCoder edited this page May 22, 2023 · 2 revisions

Minecraft has a built-in method of adding rewards for completing Advancements.

Advancement a1 = ...

// Represents an empty reward
a1.setReward(AReward.EMPTY);

// Will grant the player 20 experience points upon advancement completion
AReward r1 = new AReward(20); 
a1.setReward(r1);

// Will grant the player 30 experience points and give them any items from the specified keys of the loot table
AReward r2 = new AReward(30, Set.of(LootTables.WOLF.getKey());
a1.setReward(r2);

// Will grant the player 35 experience points and make any recipes with the matching keys visible and usable
AReward r3 = new AReward(35, Set.of(), Set.of(NamespacedKey.minecraft("myrecipekey"));
a1.setReward(r3);
Clone this wiki locally