package moe.hazu.tinkeringabnormally.data.tags;

import moe.hazu.tinkeringabnormally.TinkeringAbnormally;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.FluidTagsProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import slimeknights.mantle.registration.object.FlowingFluidObject;
import slimeknights.mantle.registration.object.FluidObject;
import slimeknights.tconstruct.common.TinkerTags;

public class FluidTagProvider extends FluidTagsProvider {
    public FluidTagProvider(DataGenerator generatorIn, ExistingFileHelper helper) {
        super(generatorIn, TinkeringAbnormally.MODID, helper);
    }

    @Override
    public void addTags() {
        tagAll(TinkeringAbnormally.moltenSpinel);
        tagLocal(TinkeringAbnormally.moltenNecromium);

        this.tag(TinkerTags.Fluids.METAL_TOOLTIPS).addTags(TinkeringAbnormally.moltenNecromium.getLocalTag());
        this.tag(TinkerTags.Fluids.LARGE_GEM_TOOLTIPS).addTags(TinkeringAbnormally.moltenSpinel.getLocalTag());
    }

    @Override
    public String getName() {
        return "Tinkering Abnormally Fluid TinkerTags";
    }

    /** Tags this fluid using local tags */
    private void tagLocal(FlowingFluidObject<?> fluid) {
        tag(fluid.getLocalTag()).add(fluid.getStill(), fluid.getFlowing());
    }

    /** Tags this fluid with local and forge tags */
    private void tagAll(FlowingFluidObject<?> fluid) {
        tagLocal(fluid);
        tag(fluid.getForgeTag()).addTag(fluid.getLocalTag());
    }

    /** Tags this fluid with local and forge tags */
    private void tagForge(FluidObject<?> fluid) {
        tag(fluid.getForgeTag()).add(fluid.get());
    }
}
