package net.minecraft.stats;

import net.minecraft.world.inventory.SmokerMenu;
import net.minecraft.world.inventory.BlastFurnaceMenu;
import net.minecraft.world.inventory.FurnaceMenu;
import net.minecraft.world.inventory.RecipeBookMenu;
import javax.annotation.Nullable;
import net.minecraft.world.item.crafting.Recipe;
import java.util.Collection;
import com.google.common.collect.Sets;
import net.minecraft.resources.ResourceLocation;
import java.util.Set;

public class RecipeBook {
    protected final Set<ResourceLocation> known;
    protected final Set<ResourceLocation> highlight;
    protected boolean guiOpen;
    protected boolean filteringCraftable;
    protected boolean furnaceGuiOpen;
    protected boolean furnaceFilteringCraftable;
    protected boolean blastingFurnaceGuiOpen;
    protected boolean blastingFurnaceFilteringCraftable;
    protected boolean smokerGuiOpen;
    protected boolean smokerFilteringCraftable;
    
    public RecipeBook() {
        this.known = Sets.newHashSet();
        this.highlight = Sets.newHashSet();
    }
    
    public void copyOverData(final RecipeBook aco) {
        this.known.clear();
        this.highlight.clear();
        this.guiOpen = aco.guiOpen;
        this.filteringCraftable = aco.filteringCraftable;
        this.furnaceGuiOpen = aco.furnaceGuiOpen;
        this.furnaceFilteringCraftable = aco.furnaceFilteringCraftable;
        this.blastingFurnaceGuiOpen = aco.blastingFurnaceGuiOpen;
        this.blastingFurnaceFilteringCraftable = aco.blastingFurnaceFilteringCraftable;
        this.smokerGuiOpen = aco.smokerGuiOpen;
        this.smokerFilteringCraftable = aco.smokerFilteringCraftable;
        this.known.addAll(aco.known);
        this.highlight.addAll(aco.highlight);
    }
    
    public void add(final Recipe<?> bmu) {
        if (!bmu.isSpecial()) {
            this.add(bmu.getId());
        }
    }
    
    protected void add(final ResourceLocation uh) {
        this.known.add(uh);
    }
    
    public boolean contains(@Nullable final Recipe<?> bmu) {
        return bmu != null && this.known.contains(bmu.getId());
    }
    
    public boolean contains(final ResourceLocation uh) {
        return this.known.contains(uh);
    }
    
    public void remove(final Recipe<?> bmu) {
        this.remove(bmu.getId());
    }
    
    protected void remove(final ResourceLocation uh) {
        this.known.remove(uh);
        this.highlight.remove(uh);
    }
    
    public boolean willHighlight(final Recipe<?> bmu) {
        return this.highlight.contains(bmu.getId());
    }
    
    public void removeHighlight(final Recipe<?> bmu) {
        this.highlight.remove(bmu.getId());
    }
    
    public void addHighlight(final Recipe<?> bmu) {
        this.addHighlight(bmu.getId());
    }
    
    protected void addHighlight(final ResourceLocation uh) {
        this.highlight.add(uh);
    }
    
    public boolean isGuiOpen() {
        return this.guiOpen;
    }
    
    public void setGuiOpen(final boolean boolean1) {
        this.guiOpen = boolean1;
    }
    
    public boolean isFilteringCraftable(final RecipeBookMenu<?> bhp) {
        if (bhp instanceof FurnaceMenu) {
            return this.furnaceFilteringCraftable;
        }
        if (bhp instanceof BlastFurnaceMenu) {
            return this.blastingFurnaceFilteringCraftable;
        }
        if (bhp instanceof SmokerMenu) {
            return this.smokerFilteringCraftable;
        }
        return this.filteringCraftable;
    }
    
    public boolean isFilteringCraftable() {
        return this.filteringCraftable;
    }
    
    public void setFilteringCraftable(final boolean boolean1) {
        this.filteringCraftable = boolean1;
    }
    
    public boolean isFurnaceGuiOpen() {
        return this.furnaceGuiOpen;
    }
    
    public void setFurnaceGuiOpen(final boolean boolean1) {
        this.furnaceGuiOpen = boolean1;
    }
    
    public boolean isFurnaceFilteringCraftable() {
        return this.furnaceFilteringCraftable;
    }
    
    public void setFurnaceFilteringCraftable(final boolean boolean1) {
        this.furnaceFilteringCraftable = boolean1;
    }
    
    public boolean isBlastingFurnaceGuiOpen() {
        return this.blastingFurnaceGuiOpen;
    }
    
    public void setBlastingFurnaceGuiOpen(final boolean boolean1) {
        this.blastingFurnaceGuiOpen = boolean1;
    }
    
    public boolean isBlastingFurnaceFilteringCraftable() {
        return this.blastingFurnaceFilteringCraftable;
    }
    
    public void setBlastingFurnaceFilteringCraftable(final boolean boolean1) {
        this.blastingFurnaceFilteringCraftable = boolean1;
    }
    
    public boolean isSmokerGuiOpen() {
        return this.smokerGuiOpen;
    }
    
    public void setSmokerGuiOpen(final boolean boolean1) {
        this.smokerGuiOpen = boolean1;
    }
    
    public boolean isSmokerFilteringCraftable() {
        return this.smokerFilteringCraftable;
    }
    
    public void setSmokerFilteringCraftable(final boolean boolean1) {
        this.smokerFilteringCraftable = boolean1;
    }
}
