/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.Codec * com.mojang.serialization.MapCodec */ package net.minecraft.advancements; import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.CriterionTrigger; import net.minecraft.advancements.CriterionTriggerInstance; import net.minecraft.util.ExtraCodecs; public record Criterion(CriterionTrigger trigger, T triggerInstance) { private static final MapCodec> MAP_CODEC = ExtraCodecs.dispatchOptionalValue("trigger", "conditions", CriteriaTriggers.CODEC, Criterion::trigger, Criterion::criterionCodec); public static final Codec> CODEC = MAP_CODEC.codec(); private static Codec> criterionCodec(CriterionTrigger trigger) { return trigger.codec().xmap(instance -> new Criterion(trigger, (CriterionTriggerInstance)instance), Criterion::triggerInstance); } }