package net.minecraft.world;

import java.util.Set;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;

public interface Container extends Clearable {
    int getContainerSize();
    
    boolean isEmpty();
    
    ItemStack getItem(final int integer);
    
    ItemStack removeItem(final int integer1, final int integer2);
    
    ItemStack removeItemNoUpdate(final int integer);
    
    void setItem(final int integer, final ItemStack ben);
    
    default int getMaxStackSize() {
        return 64;
    }
    
    void setChanged();
    
    boolean stillValid(final Player ayj);
    
    default void startOpen(final Player ayj) {
    }
    
    default void stopOpen(final Player ayj) {
    }
    
    default boolean canPlaceItem(final int integer, final ItemStack ben) {
        return true;
    }
    
    default int countItem(final Item bei) {
        int integer3 = 0;
        for (int integer4 = 0; integer4 < this.getContainerSize(); ++integer4) {
            final ItemStack ben5 = this.getItem(integer4);
            if (ben5.getItem().equals(bei)) {
                integer3 += ben5.getCount();
            }
        }
        return integer3;
    }
    
    default boolean hasAnyOf(final Set<Item> set) {
        for (int integer3 = 0; integer3 < this.getContainerSize(); ++integer3) {
            final ItemStack ben4 = this.getItem(integer3);
            if (set.contains(ben4.getItem()) && ben4.getCount() > 0) {
                return true;
            }
        }
        return false;
    }
}
