Search in sources :

Example 1 with IMixinAdvancementList

use of org.spongepowered.common.interfaces.advancement.IMixinAdvancementList in project SpongeCommon by SpongePowered.

the class AdvancementRegistryModule method registerAdditionalCatalog.

@Override
public void registerAdditionalCatalog(Advancement advancement) {
    super.register(advancement);
    ((IMixinAdvancement) advancement).setRegistered();
    if (INSIDE_REGISTER_EVENT) {
        final net.minecraft.advancements.Advancement mcAdv = (net.minecraft.advancements.Advancement) advancement;
        final IMixinAdvancementList advancementList = (IMixinAdvancementList) AdvancementManager.ADVANCEMENT_LIST;
        advancementList.getAdvancements().put(mcAdv.getId(), mcAdv);
        if (mcAdv.getParent() != SpongeAdvancementBuilder.DUMMY_ROOT_ADVANCEMENT) {
            advancementList.getNonRootsSet().add(mcAdv);
            final AdvancementList.Listener listener = advancementList.getListener();
            if (listener != null) {
                listener.nonRootAdvancementAdded(mcAdv);
            }
        }
    }
}
Also used : AdvancementList(net.minecraft.advancements.AdvancementList) IMixinAdvancementList(org.spongepowered.common.interfaces.advancement.IMixinAdvancementList) IMixinAdvancementList(org.spongepowered.common.interfaces.advancement.IMixinAdvancementList) IMixinAdvancement(org.spongepowered.common.interfaces.advancement.IMixinAdvancement) Advancement(org.spongepowered.api.advancement.Advancement) IMixinAdvancement(org.spongepowered.common.interfaces.advancement.IMixinAdvancement)

Example 2 with IMixinAdvancementList

use of org.spongepowered.common.interfaces.advancement.IMixinAdvancementList in project SpongeCommon by SpongePowered.

the class AdvancementTreeRegistryModule method registerAdditionalCatalog.

@SuppressWarnings("unchecked")
@Override
public void registerAdditionalCatalog(AdvancementTree advancementTree) {
    super.register(advancementTree);
    if (INSIDE_REGISTER_EVENT) {
        final Advancement advancement = (Advancement) advancementTree.getRootAdvancement();
        final IMixinAdvancementList advancementList = (IMixinAdvancementList) AdvancementManager.ADVANCEMENT_LIST;
        advancementList.getRootsSet().add(advancement);
        final AdvancementList.Listener listener = advancementList.getListener();
        if (listener != null) {
            listener.rootAdvancementAdded(advancement);
        }
    }
}
Also used : AdvancementList(net.minecraft.advancements.AdvancementList) IMixinAdvancementList(org.spongepowered.common.interfaces.advancement.IMixinAdvancementList) IMixinAdvancementList(org.spongepowered.common.interfaces.advancement.IMixinAdvancementList) Advancement(net.minecraft.advancements.Advancement)

Aggregations

AdvancementList (net.minecraft.advancements.AdvancementList)2 IMixinAdvancementList (org.spongepowered.common.interfaces.advancement.IMixinAdvancementList)2 Advancement (net.minecraft.advancements.Advancement)1 Advancement (org.spongepowered.api.advancement.Advancement)1 IMixinAdvancement (org.spongepowered.common.interfaces.advancement.IMixinAdvancement)1