<commit_before>package aeronicamc.mods.mxtune.inventory;


import aeronicamc.mods.mxtune.init.ModContainers;
import aeronicamc.mods.mxtune.util.IInstrument;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.IContainerFactory;

import javax.annotation.Nullable;

public class InstrumentContainer extends Container
{

    public InstrumentContainer(int windowId, World world, @Nullable BlockPos pos, PlayerInventory playerInventory , PlayerEntity playerEntity)
    {
        super(ModContainers.INSTRUMENT_CONTAINER.get(), windowId);
        InstrumentInventory instrumentInventory = new InstrumentInventory(playerEntity.getItemInHand(Hand.MAIN_HAND));

        this.addSlot(new SlotInstrument(instrumentInventory, 0, 12, 8 + 2 * 18));

        // Player Inventory
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 9; j++) {
                this.addSlot(new Slot(playerInventory, j + i * 9 + 9, j * 18 + 12, i * 18 + 84));
            }
        }

        // Player HotBar
        for (int i = 0; i < 9; i++) {
            this.addSlot(new SlotHotBar(playerInventory, i, i * 18 + 12, 142));
        }
    }

    public ITextComponent getName()
    {
        return new StringTextComponent("The Inventory");
    }

    @Override
    public boolean stillValid(PlayerEntity playerIn) {
        return !playerIn.isHurt();
    }

    // Transfer the item in test slot to-from any other open slot
    @Override
    public ItemStack quickMoveStack(PlayerEntity playerIn, int index) {
        ItemStack itemstack = ItemStack.EMPTY;
        Slot slot = this.slots.get(index);
        if (slot != null && slot.hasItem()) {
            ItemStack stack = slot.getItem();<commit_msg>Fixed: Doh! no wonder the inv gui kept closing when hearts were not full.<commit_after>package aeronicamc.mods.mxtune.inventory;


import aeronicamc.mods.mxtune.init.ModContainers;
import aeronicamc.mods.mxtune.util.IInstrument;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.IContainerFactory;

import javax.annotation.Nullable;

public class InstrumentContainer extends Container
{

    public InstrumentContainer(int windowId, World world, @Nullable BlockPos pos, PlayerInventory playerInventory , PlayerEntity playerEntity)
    {
        super(ModContainers.INSTRUMENT_CONTAINER.get(), windowId);
        InstrumentInventory instrumentInventory = new InstrumentInventory(playerEntity.getItemInHand(Hand.MAIN_HAND));

        this.addSlot(new SlotInstrument(instrumentInventory, 0, 12, 8 + 2 * 18));

        // Player Inventory
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 9; j++) {
                this.addSlot(new Slot(playerInventory, j + i * 9 + 9, j * 18 + 12, i * 18 + 84));
            }
        }

        // Player HotBar
        for (int i = 0; i < 9; i++) {
            this.addSlot(new SlotHotBar(playerInventory, i, i * 18 + 12, 142));
        }
    }

    public ITextComponent getName()
    {
        return new StringTextComponent("The Inventory");
    }

    @Override
    public boolean stillValid(PlayerEntity playerIn) {
        return playerIn.isAlive();
    }

    // Transfer the item in test slot to-from any other open slot
    @Override
    public ItemStack quickMoveStack(PlayerEntity playerIn, int index) {
        ItemStack itemstack = ItemStack.EMPTY;
        Slot slot = this.slots.get(index);
        if (slot != null && slot.hasItem()) {
            ItemStack stack = slot.getItem();
{'fraction_non_alphanumeric': 0.10252996005326231, 'fraction_numerical': 0.013315579227696404, 'mean_word_length': 3.3545893719806763, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4046179', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1332, 'n_words': 318}