use of net.minecraft.advancements.Advancement 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);
}
}
}
use of net.minecraft.advancements.Advancement in project ManaCraft by Yaossg.
the class Util method giveAdvancement.
public static void giveAdvancement(Entity player, String advance) {
if (player.getServer() != null) {
MinecraftServer server = player.getServer();
if (player instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) player;
Advancement advancement = server.getAdvancementManager().getAdvancement(new ResourceLocation(advance));
AdvancementProgress progress = playerMP.getAdvancements().getProgress(advancement);
if (!progress.isDone()) {
for (String s : progress.getRemaningCriteria()) {
playerMP.getAdvancements().grantCriterion(advancement, s);
}
}
}
}
}
Aggregations