package net.minecraft.util.datafix.fixes;

import java.util.function.Function;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.Typed;
import com.mojang.datafixers.Dynamic;
import com.mojang.datafixers.schemas.Schema;

public class CatTypeFix extends NamedEntityFix {
    public CatTypeFix(final Schema schema, final boolean boolean2) {
        super(schema, boolean2, "CatTypeFix", References.ENTITY, "minecraft:cat");
    }
    
    public Dynamic<?> fixTag(final Dynamic<?> dynamic) {
        if (dynamic.get("CatType").asInt(0) == 9) {
            return dynamic.set("CatType", dynamic.createInt(10));
        }
        return dynamic;
    }
    
    @Override
    protected Typed<?> fix(final Typed<?> typed) {
        return typed.update(DSL.remainderFinder(), (Function)this::fixTag);
    }
}
