<commit_before>package de.webtwob.mbma.common.inventory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.SlotItemHandler;

/**
 * Created by BB20101997 on 17. Mär. 2017.
 */
public class QSContainer extends Container {

    int xSize = 176;
    int ySize = 220;

    @Override
    public boolean canInteractWith(EntityPlayer playerIn) {

        return true;
    }

    public QSContainer(InventoryPlayer playerInv, IItemHandler qsInventory, EntityPlayer player) {
        layoutPlayerInventory(playerInv);
        layoutQSInventory(qsInventory);
    }

    private void layoutQSInventory(IItemHandler qsInventory) {
        for(int col = 0; col < 3; col++) {
            for(int row = 0; row < 6; ++row) {
                addSlotToContainer(new SlotItemHandler(qsInventory, row + col * 6, 8 + col * 18, 18 + 18 * row));
            }
        }
    }

    protected void layoutPlayerInventory(InventoryPlayer player) {
        for(int row = 0; row < 3; row++) {
            for(int col = 0; col < 9; col++) {
                addSlotToContainer(new Slot(player, col + row * 9 + 9, 8 + col * 18, ySize - 10 - (4 - row) * 18));
            }
        }

        for(int hotbar = 0; hotbar < 9; hotbar++) {
            addSlotToContainer(new Slot(player, hotbar, 8 + hotbar * 18, ySize - 24));<commit_msg>Fixed crash on shift clicking a stack into the inventory<commit_after>package de.webtwob.mbma.common.inventory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.SlotItemHandler;

/**
 * Created by BB20101997 on 17. Mär. 2017.
 */
public class QSContainer extends Container {

    int xSize = 176;
    int ySize = 220;

    @Override
    public boolean canInteractWith(EntityPlayer playerIn) {

        return true;
    }

    @Override
    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {

        ItemStack ret = ItemStack.EMPTY;
        Slot slot = inventorySlots.get(index);
        if(slot!=null&&slot.getHasStack()){

            ItemStack inSlot = slot.getStack();
            ret = inSlot.copy();

            //from player inventory
            if(index < 4*9 ){
                if(!mergeItemStack(inSlot,4*9,this.inventorySlots.size(),false)){
                    return ItemStack.EMPTY;
                }
            }else if(!mergeItemStack(inSlot,0,4*9,true)){
                return  ItemStack.EMPTY;
            }
            if(inSlot.isEmpty()){
                slot.putStack(ItemStack.EMPTY);
            }else{
                slot.onSlotChanged();
            }

        }
        return ret;
    }

    public QSContainer(InventoryPlayer playerInv, IItemHandler qsInventory, EntityPlayer player) {
        layoutPlayerInventory(playerInv);
        layoutQSInventory(qsInventory);
    }

    private void layoutQSInventory(IItemHandler qsInventory) {
        for(int col = 0; col < 3; col++) {
            for(int row = 0; row < 6; ++row) {
                addSlotToContainer(new SlotItemHandler(qsInventory, row + col * 6, 8 + col * 18, 18 + 18 * row));
            }
        }
    }

    protected void layoutPlayerInventory(InventoryPlayer player) {
        for(int row = 0; row < 3; row++) {
            for(int col = 0; col < 9; col++) {
                addSlotToContainer(new Slot(player, col + row * 9 + 9, 8 + col * 18, ySize - 10 - (4 - row) * 18));
            }
        }

        for(int hotbar = 0; hotbar < 9; hotbar++) {
            addSlotToContainer(new Slot(player, hotbar, 8 + hotbar * 18, ySize - 24));
{'fraction_non_alphanumeric': 0.10910017843487127, 'fraction_numerical': 0.028804486362477694, 'mean_word_length': 2.37984496124031, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6888486', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1171, 'n_words': 285}