Fabric API

Fabric API

106M Downloads

Custom advancement criterion registry

EliteMasterEric opened this issue ยท 5 comments

commented

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.

commented

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.

commented

Advancement criteria are very repetitive - should Fabric API provide a general implementation plus the mixin hook

commented

Any update on this?

commented

we can probably include this in object builders module.

commented

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?