Hi, guys, is there any way to auto-grant a root advancement whenever the player logs in? I've tried using minecraft:tick and InventoryChangeTrigger, but the first one doesn't work, and the second one doesn't guarantee a log-in-grant. I'm using 1.20.1
public class ModAdvancementGenerator implements ForgeAdvancementProvider.AdvancementGenerator {
@Override
public void generate(HolderLookup.Provider registries, Consumer<Advancement> saver, ExistingFileHelper existingFileHelper) {
// Define a root advancement.
Advancement root = Advancement.Builder.advancement()
.display(
ModItems.COMPRESSED_DIAMOND.get(), // Icon
Component.literal("Compressed"), // Title
Component.literal("Explore Compressed tools and armor!"), // Description
new ResourceLocation("compressed","textures/block/compressed_diamond_block.png"), // Background image (null if not used)
FrameType.TASK, // Frame type (TASK, GOAL, or CHALLENGE)
true, // Show toast?
true, // Announce in chat?
false // Hidden?
)
/*
.addCriterion("tick", new InventoryChangeTrigger.TriggerInstance());
????????????????????????????????????????????????????? */
// Notice we now pass the advancement ID as a string (the path part) plus the existingFileHelper.
.save(saver, new ResourceLocation("compressed","compressed_root_advancement"), existingFileHelper);
}
}