// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.inventory.container;

import com.hypixel.hytale.server.core.inventory.container.filter.SlotFilter;
import com.hypixel.hytale.server.core.inventory.container.filter.FilterActionType;
import com.hypixel.hytale.server.core.inventory.container.filter.FilterType;
import java.util.function.Consumer;
import com.hypixel.hytale.protocol.ItemWithAllMetadata;
import java.util.Map;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.function.consumer.ShortObjectConsumer;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.inventory.transaction.ClearTransaction;
import com.hypixel.hytale.event.EventRegistration;
import com.hypixel.hytale.codec.builder.BuilderCodec;

public class EmptyItemContainer extends ItemContainer
{
    public static final EmptyItemContainer INSTANCE;
    public static final BuilderCodec<EmptyItemContainer> CODEC;
    private static final EventRegistration<Void, ItemContainerChangeEvent> EVENT_REGISTRATION;
    
    protected EmptyItemContainer() {
    }
    
    @Override
    public short getCapacity() {
        return 0;
    }
    
    @Nonnull
    @Override
    public ClearTransaction clear() {
        return ClearTransaction.EMPTY;
    }
    
    @Override
    public void forEach(final ShortObjectConsumer<ItemStack> action) {
    }
    
    @Override
    protected <V> V readAction(@Nonnull final Supplier<V> action) {
        return action.get();
    }
    
    @Override
    protected <X, V> V readAction(@Nonnull final Function<X, V> action, final X x) {
        return action.apply(x);
    }
    
    @Override
    protected <V> V writeAction(@Nonnull final Supplier<V> action) {
        return action.get();
    }
    
    @Override
    protected <X, V> V writeAction(@Nonnull final Function<X, V> action, final X x) {
        return action.apply(x);
    }
    
    @Nonnull
    @Override
    protected ClearTransaction internal_clear() {
        return ClearTransaction.EMPTY;
    }
    
    @Override
    protected ItemStack internal_getSlot(final short slot) {
        throw new UnsupportedOperationException("getSlot(int) is not supported in EmptyItemContainer");
    }
    
    @Override
    protected ItemStack internal_setSlot(final short slot, final ItemStack itemStack) {
        throw new UnsupportedOperationException("setSlot(int, ItemStack) is not supported in EmptyItemContainer");
    }
    
    @Override
    protected ItemStack internal_removeSlot(final short slot) {
        throw new UnsupportedOperationException("removeSlot(int) is not supported in EmptyItemContainer");
    }
    
    @Override
    protected boolean cantAddToSlot(final short slot, final ItemStack itemStack, final ItemStack slotItemStack) {
        return false;
    }
    
    @Override
    protected boolean cantRemoveFromSlot(final short slot) {
        return false;
    }
    
    @Override
    protected boolean cantDropFromSlot(final short slot) {
        return false;
    }
    
    @Override
    protected boolean cantMoveToSlot(final ItemContainer fromContainer, final short slotFrom) {
        return false;
    }
    
    @Nonnull
    @Override
    public List<ItemStack> removeAllItemStacks() {
        return Collections.emptyList();
    }
    
    @Nonnull
    @Override
    public Map<Integer, ItemWithAllMetadata> toProtocolMap() {
        return Collections.emptyMap();
    }
    
    @Override
    public EmptyItemContainer clone() {
        return EmptyItemContainer.INSTANCE;
    }
    
    @Override
    public EventRegistration registerChangeEvent(final short priority, final Consumer<ItemContainerChangeEvent> consumer) {
        return EmptyItemContainer.EVENT_REGISTRATION;
    }
    
    @Override
    public void setGlobalFilter(final FilterType globalFilter) {
    }
    
    @Override
    public void setSlotFilter(final FilterActionType actionType, final short slot, final SlotFilter filter) {
        ItemContainer.validateSlotIndex(slot, 0);
    }
    
    static {
        INSTANCE = new EmptyItemContainer();
        CODEC = BuilderCodec.builder(EmptyItemContainer.class, () -> EmptyItemContainer.INSTANCE).build();
        EVENT_REGISTRATION = new EventRegistration<Void, ItemContainerChangeEvent>(ItemContainerChangeEvent.class, () -> false, () -> {});
    }
}
