<commit_before>package xyz.brassgoggledcoders.boilerplate.tileentities;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import xyz.brassgoggledcoders.boilerplate.client.guis.IOpenableGUI;

import javax.annotation.Nonnull;

/**
 * Basic machine class.Every machine that has an inventory should extend this.
 *
 * @author decebaldecebal
 *
 */
public abstract class BaseTileWithInventory extends TileEntity implements IInventory, IOpenableGUI, IOnSlotChanged
{
	public ItemStack[] inventory;

	public BaseTileWithInventory(int invSize)
	{
		this.inventory = new ItemStack[invSize];
	}

	@Override
	public void readFromNBT(NBTTagCompound tag)
	{
		super.readFromNBT(tag);

		NBTTagList nbttaglist = (NBTTagList) tag.getTag("Items");
		this.inventory = new ItemStack[this.getSizeInventory()];

		for (int i = 0; i < nbttaglist.tagCount(); ++i)
		{
			NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
			byte b0 = nbttagcompound1.getByte("Slot");

			if ((b0 >= 0) && (b0 < this.inventory.length))
			{
				this.inventory[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
			}
		}
	}

	@Override
	@Nonnull
	public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound)
	{
		nbtTagCompound = super.writeToNBT(nbtTagCompound);

		NBTTagList inventoryTaglist = new NBTTagList();

		for (int i = 0; i < this.inventory.length; ++i)
		{
			if (this.inventory[i] != null)
			{
				NBTTagCompound inventorySlot = new NBTTagCompound();
				inventorySlot.setByte("Slot", (byte) i);
				this.inventory[i].writeToNBT(inventorySlot);
				inventoryTaglist.appendTag(inventorySlot);
			}
		}

		nbtTagCompound.setTag("Items", inventoryTaglist);
		return nbtTagCompound;
	}

	@Override
	public int getSizeInventory()
	{
		return this.inventory.length;
	}

	@Override
	public ItemStack getStackInSlot(int par1)
	{
		return this.inventory[par1];
	}

	@Override
	public ItemStack decrStackSize(int par1, int par2)
	{
		if (this.inventory[par1] != null)
		{
			ItemStack var3;

			if (this.inventory[par1].stackSize <= par2)
			{
				var3 = this.inventory[par1];
				this.inventory[par1] = null;
				return var3;
			}
			else
			{
				var3 = this.inventory[par1].splitStack(par2);

				if (this.inventory[par1].stackSize == 0)
				{
					this.inventory[par1] = null;
				}

				return var3;
			}
		}
		else
		{
			return null;
		}
	}

	@Override
	public ItemStack removeStackFromSlot(int index)
	{
		return null;
	}

	@Override
	public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
	{
		this.inventory[par1] = par2ItemStack;

		if ((par2ItemStack != null) && (par2ItemStack.stackSize > this.getInventoryStackLimit()))
		{
			par2ItemStack.stackSize = this.getInventoryStackLimit();
		}
	}

	@Override
	public int getInventoryStackLimit()
	{
		return 64;
	}

	@Override
	public boolean isUseableByPlayer(EntityPlayer player)
	{
		return (this.worldObj.getTileEntity(this.getPos()) == this) && (player.getDistanceSqToCenter(this.getPos()) <= 64.0D);
	}

	@Override
	public void openInventory(EntityPlayer player)
	{

	}

	@Override
	public void closeInventory(EntityPlayer player)
	{

	}

	@Override
	public boolean isItemValidForSlot(int i, ItemStack itemstack)
	{
		return false;
	}

	@Override
	public int getField(int id)
	{
		return 0;
	}

	@Override
	public void setField(int id, int value)
	{

	}

	@Override
	public int getFieldCount()
	{
		return 0;
	}

	@Override
	public void clear()
	{

	}

	@Override
	public void onSlotChanged(Slot slot)
	{
	}

	@Override
	public abstract Object getClientGuiElement(int ID, EntityPlayer player, World world, BlockPos blockPos);

	@Override
	public abstract Object getServerGuiElement(int ID, EntityPlayer player, World world, BlockPos blockPos);

	@Override
	public String getName()
	{
		return "";
	}

	@Override
	public boolean hasCustomName()
	{
		return !this.getName().isEmpty();
	}

	@Override
	public ITextComponent getDisplayName()
	{
		return null;
	}
}<commit_msg>Forgot to change IOpenableGui implements!<commit_after>package xyz.brassgoggledcoders.boilerplate.tileentities;

import net.minecraft.client.gui.Gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import xyz.brassgoggledcoders.boilerplate.client.guis.IOpenableGUI;

import javax.annotation.Nonnull;

/**
 * Basic machine class.Every machine that has an inventory should extend this.
 *
 * @author decebaldecebal
 *
 */
public abstract class BaseTileWithInventory extends TileEntity implements IInventory, IOpenableGUI, IOnSlotChanged
{
	public ItemStack[] inventory;

	public BaseTileWithInventory(int invSize)
	{
		this.inventory = new ItemStack[invSize];
	}

	@Override
	public void readFromNBT(NBTTagCompound tag)
	{
		super.readFromNBT(tag);

		NBTTagList nbttaglist = (NBTTagList) tag.getTag("Items");
		this.inventory = new ItemStack[this.getSizeInventory()];

		for (int i = 0; i < nbttaglist.tagCount(); ++i)
		{
			NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
			byte b0 = nbttagcompound1.getByte("Slot");

			if ((b0 >= 0) && (b0 < this.inventory.length))
			{
				this.inventory[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
			}
		}
	}

	@Override
	@Nonnull
	public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound)
	{
		nbtTagCompound = super.writeToNBT(nbtTagCompound);

		NBTTagList inventoryTaglist = new NBTTagList();

		for (int i = 0; i < this.inventory.length; ++i)
		{
			if (this.inventory[i] != null)
			{
				NBTTagCompound inventorySlot = new NBTTagCompound();
				inventorySlot.setByte("Slot", (byte) i);
				this.inventory[i].writeToNBT(inventorySlot);
				inventoryTaglist.appendTag(inventorySlot);
			}
		}

		nbtTagCompound.setTag("Items", inventoryTaglist);
		return nbtTagCompound;
	}

	@Override
	public int getSizeInventory()
	{
		return this.inventory.length;
	}

	@Override
	public ItemStack getStackInSlot(int par1)
	{
		return this.inventory[par1];
	}

	@Override
	public ItemStack decrStackSize(int par1, int par2)
	{
		if (this.inventory[par1] != null)
		{
			ItemStack var3;

			if (this.inventory[par1].stackSize <= par2)
			{
				var3 = this.inventory[par1];
				this.inventory[par1] = null;
				return var3;
			}
			else
			{
				var3 = this.inventory[par1].splitStack(par2);

				if (this.inventory[par1].stackSize == 0)
				{
					this.inventory[par1] = null;
				}

				return var3;
			}
		}
		else
		{
			return null;
		}
	}

	@Override
	public ItemStack removeStackFromSlot(int index)
	{
		return null;
	}

	@Override
	public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
	{
		this.inventory[par1] = par2ItemStack;

		if ((par2ItemStack != null) && (par2ItemStack.stackSize > this.getInventoryStackLimit()))
		{
			par2ItemStack.stackSize = this.getInventoryStackLimit();
		}
	}

	@Override
	public int getInventoryStackLimit()
	{
		return 64;
	}

	@Override
	public boolean isUseableByPlayer(EntityPlayer player)
	{
		return (this.worldObj.getTileEntity(this.getPos()) == this) && (player.getDistanceSqToCenter(this.getPos()) <= 64.0D);
	}

	@Override
	public void openInventory(EntityPlayer player)
	{

	}

	@Override
	public void closeInventory(EntityPlayer player)
	{

	}

	@Override
	public boolean isItemValidForSlot(int i, ItemStack itemstack)
	{
		return false;
	}

	@Override
	public int getField(int id)
	{
		return 0;
	}

	@Override
	public void setField(int id, int value)
	{

	}

	@Override
	public int getFieldCount()
	{
		return 0;
	}

	@Override
	public void clear()
	{

	}

	@Override
	public void onSlotChanged(Slot slot)
	{
	}

	@Override
	public abstract Gui getClientGuiElement(int ID, EntityPlayer player, World world, BlockPos blockPos);

	@Override
	public abstract Container getServerGuiElement(int ID, EntityPlayer player, World world, BlockPos blockPos);

	@Override
	public String getName()
	{
		return "";
	}

	@Override
	public boolean hasCustomName()
	{
		return !this.getName().isEmpty();
	}

	@Override
	public ITextComponent getDisplayName()
	{
		return null;
	}
}
{'fraction_non_alphanumeric': 0.1100264155277363, 'fraction_numerical': 0.00987711037096589, 'mean_word_length': 4.329253365973072, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, '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': '5111297', 'n_tokens_mistral': 3403, 'n_tokens_neox': 3098, 'n_words': 610}