use of net.minecraft.advancements.CriterionProgress in project SpongeCommon by SpongePowered.
the class MixinPlayerAdvancements method onUnregisterListenersGetProgress.
@Redirect(method = "registerListeners(Lnet/minecraft/advancements/Advancement;)V", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/advancements/CriterionProgress;isObtained()Z"))
private boolean onUnregisterListenersGetProgress(CriterionProgress progress) {
final AdvancementCriterion criterion = ((org.spongepowered.api.advancement.criteria.CriterionProgress) progress).getCriterion();
final IMixinCriterion mixinCriterion = (IMixinCriterion) criterion;
// Only remove the trigger once the goal is reached
if (mixinCriterion.getScoreCriterion() != null) {
return ((IMixinCriterionProgress) progress).getAdvancementProgress().get(mixinCriterion.getScoreCriterion()).get().achieved();
}
return progress.isObtained();
}
Aggregations