package com.thebrokenrail.twine.util.backpack.gui;

import com.thebrokenrail.twine.Twine;
import com.thebrokenrail.twine.util.backpack.inventory.BackpackInventory;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.screen.GenericContainerScreenHandler;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Hand;

public class BackpackScreenHandler extends GenericContainerScreenHandler {
    public BackpackScreenHandler(int i, PlayerInventory playerInventory, PacketByteBuf buf) {
        this(i, playerInventory, buf.readBoolean(), buf.readEnumConstant(Hand.class));
    }

    public BackpackScreenHandler(int i, PlayerInventory playerInventory, boolean large, Hand hand) {
        this(Twine.BACKPACK_SCREEN_TYPE, i, playerInventory, new BackpackInventory(9 * (large ? 6 : 3), playerInventory.player, hand));
    }

    public BackpackScreenHandler(ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, Inventory inventory) {
        super(type, syncId, playerInventory, inventory, inventory.size() / 9);
    }
}
