Jump to content

Recommended Posts

Posted

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);
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.