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 aal) {
        this.known.clear();
        this.highlight.clear();
        this.known.addAll(aal.known);
        this.highlight.addAll(aal.highlight);
    }
    
    public void add(final Recipe<?> bgw) {
        if (!bgw.isSpecial()) {
            this.add(bgw.getId());
        }
    }
    
    protected void add(final ResourceLocation sm) {
        this.known.add(sm);
    }
    
    public boolean contains(@Nullable final Recipe<?> bgw) {
        return bgw != null && this.known.contains(bgw.getId());
    }
    
    public boolean contains(final ResourceLocation sm) {
        return this.known.contains(sm);
    }
    
    public void remove(final Recipe<?> bgw) {
        this.remove(bgw.getId());
    }
    
    protected void remove(final ResourceLocation sm) {
        this.known.remove(sm);
        this.highlight.remove(sm);
    }
    
    public boolean willHighlight(final Recipe<?> bgw) {
        return this.highlight.contains(bgw.getId());
    }
    
    public void removeHighlight(final Recipe<?> bgw) {
        this.highlight.remove(bgw.getId());
    }
    
    public void addHighlight(final Recipe<?> bgw) {
        this.addHighlight(bgw.getId());
    }
    
    protected void addHighlight(final ResourceLocation sm) {
        this.highlight.add(sm);
    }
    
    public boolean isGuiOpen() {
        return this.guiOpen;
    }
    
    public void setGuiOpen(final boolean boolean1) {
        this.guiOpen = boolean1;
    }
    
    public boolean isFilteringCraftable(final RecipeBookMenu<?> bbt) {
        if (bbt instanceof FurnaceMenu) {
            return this.furnaceFilteringCraftable;
        }
        if (bbt instanceof BlastFurnaceMenu) {
            return this.blastingFurnaceFilteringCraftable;
        }
        if (bbt 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;
    }
}
