question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom advancement criterion registry

See original GitHub issue

I am unable to determine how to add custom advancement criteria that I can trigger.

net.minecraft.advancement.criterion.CriterionCriterions has a registration function but it is private. Unlike other registers, criterion do not have their own register yet.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
UpcraftLPcommented, Jul 26, 2019

this can in fact be easily done with a invoker mixin:

@SuppressWarnings("PublicStaticMixinMember")
@Mixin(Criterions.class)
public interface CriterionRegistryAccessor {

    @Invoker("register")
    static <T extends Criterion<?>> T registerCriterion(T criterion) {
        return null;
    }
}

the question remains whether that should be added to fabric API or whether mods should do that themselves, given how trivial the mixin is.

0reactions
mainrscommented, May 9, 2020

Hey! I wanted to get started on fabric development 😃 This looks like an easy feature to add for new people so I wanted to ask if I can take this over.

Is there some preferred way to expose the Criterion API or is making the register function statis good enough?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CriterionRegistry (fabric-api 0.32.5+local-1.16 API)
Registers a criterion for a trigger for advancements. Methods inherited from class java.lang.Object · clone, equals, finalize, getClass, hashCode, notify, ...
Read more >
[1.16.1] Advancement quantity criterion - Modder Support
You can call CriteriaTriggers.register from FMLCommonSetupEvent (use DeferredWorkQueue, the registry is just a HashMap and thus not threadsafe).
Read more >
Advancement/JSON format - Minecraft Wiki - Fandom
Custom advancements in data packs of a Minecraft world store the advancement ... When a criterion is newly completed or revoked, the advancement...
Read more >
CriterionRegistry
CriterionRegistry ... Allows registering advancement criteria for triggers. A registered criterion (trigger) can be retrieved through getById. Functions Sources
Read more >
Minecraft Modding: Custom Triggers (a.k.a. Criteria)
As explained in my overview on advancements, sometimes you want to create a ... So in order to register custom triggers (called "criterion")...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found