package net.minecraft.world.inventory;

import javax.annotation.Nullable;
import net.minecraft.resources.ResourceLocation;
import com.mojang.datafixers.util.Pair;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.Container;

public class Slot {
    private final int slot;
    public final Container container;
    public int index;
    public final int x;
    public final int y;
    
    public Slot(final Container amz, final int integer2, final int integer3, final int integer4) {
        this.container = amz;
        this.slot = integer2;
        this.x = integer3;
        this.y = integer4;
    }
    
    public void onQuickCraft(final ItemStack bki1, final ItemStack bki2) {
        final int integer4 = bki2.getCount() - bki1.getCount();
        if (integer4 > 0) {
            this.onQuickCraft(bki2, integer4);
        }
    }
    
    protected void onQuickCraft(final ItemStack bki, final int integer) {
    }
    
    protected void onSwapCraft(final int integer) {
    }
    
    protected void checkTakeAchievements(final ItemStack bki) {
    }
    
    public ItemStack onTake(final Player bec, final ItemStack bki) {
        this.setChanged();
        return bki;
    }
    
    public boolean mayPlace(final ItemStack bki) {
        return true;
    }
    
    public ItemStack getItem() {
        return this.container.getItem(this.slot);
    }
    
    public boolean hasItem() {
        return !this.getItem().isEmpty();
    }
    
    public void set(final ItemStack bki) {
        this.container.setItem(this.slot, bki);
        this.setChanged();
    }
    
    public void setChanged() {
        this.container.setChanged();
    }
    
    public int getMaxStackSize() {
        return this.container.getMaxStackSize();
    }
    
    public int getMaxStackSize(final ItemStack bki) {
        return this.getMaxStackSize();
    }
    
    @Nullable
    public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
        return null;
    }
    
    public ItemStack remove(final int integer) {
        return this.container.removeItem(this.slot, integer);
    }
    
    public boolean mayPickup(final Player bec) {
        return true;
    }
    
    public boolean isActive() {
        return true;
    }
}
