package net.minecraft.world.inventory;

import javax.annotation.Nullable;
import net.minecraft.world.entity.player.Player;
import java.util.List;
import net.minecraft.world.ContainerHelper;
import java.util.Iterator;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.NonNullList;
import net.minecraft.world.Container;

public class ResultContainer implements Container, RecipeHolder {
    private final NonNullList<ItemStack> itemStacks;
    private Recipe<?> recipeUsed;
    
    public ResultContainer() {
        this.itemStacks = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
    }
    
    @Override
    public int getContainerSize() {
        return 1;
    }
    
    @Override
    public boolean isEmpty() {
        for (final ItemStack ben3 : this.itemStacks) {
            if (!ben3.isEmpty()) {
                return false;
            }
        }
        return true;
    }
    
    @Override
    public ItemStack getItem(final int integer) {
        return this.itemStacks.get(0);
    }
    
    @Override
    public ItemStack removeItem(final int integer1, final int integer2) {
        return ContainerHelper.takeItem(this.itemStacks, 0);
    }
    
    @Override
    public ItemStack removeItemNoUpdate(final int integer) {
        return ContainerHelper.takeItem(this.itemStacks, 0);
    }
    
    @Override
    public void setItem(final int integer, final ItemStack ben) {
        this.itemStacks.set(0, ben);
    }
    
    @Override
    public void setChanged() {
    }
    
    @Override
    public boolean stillValid(final Player ayj) {
        return true;
    }
    
    @Override
    public void clearContent() {
        this.itemStacks.clear();
    }
    
    @Override
    public void setRecipeUsed(@Nullable final Recipe<?> bgw) {
        this.recipeUsed = bgw;
    }
    
    @Nullable
    @Override
    public Recipe<?> getRecipeUsed() {
        return this.recipeUsed;
    }
}
