use of net.minecraft.advancements.AdvancementList 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);
}
}
}
}
use of net.minecraft.advancements.AdvancementList 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);
}
}
}
Aggregations