<commit_before>package codechicken.lib.inventory;

import codechicken.lib.vec.Vector3;
import com.google.common.base.Objects;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryLargeChest;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

public class InventoryUtils
{
    /**
     * Constructor for ItemStack with tag
     */
    public static ItemStack newItemStack(Item item, int size, int damage, NBTTagCompound tag) {
        ItemStack stack = new ItemStack(item, size, damage);
        stack.stackTagCompound = tag;
        return stack;
    }

    /**
     * Gets the actual damage of an item without asking the Item
     */
    public static int actualDamage(ItemStack stack) {
        return Items.diamond.getDamage(stack);
    }

    /**
     * Static default implementation for IInventory method
     */
    public static ItemStack decrStackSize(IInventory inv, int slot, int size) {
        ItemStack item = inv.getStackInSlot(slot);

        if (item != null) {
            if (item.stackSize <= size) {
                inv.setInventorySlotContents(slot, null);
                inv.markDirty();
                return item;
            }
            ItemStack itemstack1 = item.splitStack(size);
            if (item.stackSize == 0)
                inv.setInventorySlotContents(slot, null);

            inv.markDirty();
            return itemstack1;
        }
        return null;
    }

    /**
     * Static default implementation for IInventory method
     */
    public static ItemStack getStackInSlotOnClosing(IInventory inv, int slot) {
        ItemStack stack = inv.getStackInSlot(slot);<commit_msg>Set ItemStack in the IInventory again after modifiing<commit_after>package codechicken.lib.inventory;

import codechicken.lib.vec.Vector3;
import com.google.common.base.Objects;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryLargeChest;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

public class InventoryUtils
{
    /**
     * Constructor for ItemStack with tag
     */
    public static ItemStack newItemStack(Item item, int size, int damage, NBTTagCompound tag) {
        ItemStack stack = new ItemStack(item, size, damage);
        stack.stackTagCompound = tag;
        return stack;
    }

    /**
     * Gets the actual damage of an item without asking the Item
     */
    public static int actualDamage(ItemStack stack) {
        return Items.diamond.getDamage(stack);
    }

    /**
     * Static default implementation for IInventory method
     */
    public static ItemStack decrStackSize(IInventory inv, int slot, int size) {
        ItemStack item = inv.getStackInSlot(slot);

        if (item != null) {
            if (item.stackSize <= size) {
                inv.setInventorySlotContents(slot, null);
                inv.markDirty();
                return item;
            }
            ItemStack itemstack1 = item.splitStack(size);
            if (item.stackSize == 0)
                inv.setInventorySlotContents(slot, null);
            else
                inv.setInventorySlotContents(slot, item);

            inv.markDirty();
            return itemstack1;
        }
        return null;
    }

    /**
     * Static default implementation for IInventory method
     */
    public static ItemStack getStackInSlotOnClosing(IInventory inv, int slot) {
        ItemStack stack = inv.getStackInSlot(slot);
{'fraction_non_alphanumeric': 0.08904905835852127, 'fraction_numerical': 0.001860032550569635, 'mean_word_length': 2.8206039076376554, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3394792', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1227, 'n_words': 287}