package net.minecraft.advancements.critereon;

import com.google.gson.JsonObject;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.advancements.CriterionTriggerInstance;

public abstract class AbstractCriterionTriggerInstance implements CriterionTriggerInstance {
    private final ResourceLocation criterion;
    private final EntityPredicate.Composite player;
    
    public AbstractCriterionTriggerInstance(final ResourceLocation uh, final EntityPredicate.Composite b) {
        this.criterion = uh;
        this.player = b;
    }
    
    @Override
    public ResourceLocation getCriterion() {
        return this.criterion;
    }
    
    protected EntityPredicate.Composite getPlayerPredicate() {
        return this.player;
    }
    
    @Override
    public JsonObject serializeToJson(final SerializationContext cg) {
        final JsonObject jsonObject3 = new JsonObject();
        jsonObject3.add("player", this.player.toJson(cg));
        return jsonObject3;
    }
    
    @Override
    public String toString() {
        return "AbstractCriterionInstance{criterion=" + this.criterion + '}';
    }
}
