use of org.spongepowered.common.interfaces.advancement.IMixinCriterion in project SpongeCommon by SpongePowered.
the class MixinPlayerAdvancements method onUnregisterListenersGetProgress.
@Nullable
@Redirect(method = "unregisterListeners", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/advancements/AdvancementProgress;getCriterionProgress(Ljava/lang/String;)Lnet/minecraft/advancements/CriterionProgress;"))
private CriterionProgress onUnregisterListenersGetProgress(AdvancementProgress advancementProgress, String criterion) {
final org.spongepowered.api.advancement.Advancement advancement = ((org.spongepowered.api.advancement.AdvancementProgress) advancementProgress).getAdvancement();
final AdvancementCriterion advancementCriterion = (AdvancementCriterion) ((Advancement) advancement).getCriteria().get(criterion);
final IMixinCriterion mixinCriterion = (IMixinCriterion) advancementCriterion;
// Only remove the trigger once the goal is reached
if (mixinCriterion.getScoreCriterion() != null && !((org.spongepowered.api.advancement.AdvancementProgress) advancementProgress).get(mixinCriterion.getScoreCriterion()).get().achieved()) {
return null;
}
return advancementProgress.getCriterionProgress(criterion);
}
use of org.spongepowered.common.interfaces.advancement.IMixinCriterion in project SpongeCommon by SpongePowered.
the class SpongeCriterionBuilder method build0.
@Override
AdvancementCriterion build0() {
final Criterion criterion = new Criterion((ICriterionInstance) this.trigger);
((IMixinCriterion) criterion).setName(this.name);
return (AdvancementCriterion) criterion;
}
Aggregations