<commit_before>/**
 * This class was created by BrassGoggledCoders modding team.
 * This class is available as part of the Steamcraft 2 Mod for Minecraft.
 *
 * Steamcraft 2 is open-source and is distributed under the MMPL v1.0 License.
 * (http://www.mod-buildcraft.com/MMPL-1.0.txt)
 *
 * Steamcraft 2 is based on the original Steamcraft Mod created by Proloe.
 * Steamcraft (c) Proloe 2011
 * (http://www.minecraftforum.net/topic/251532-181-steamcraft-source-code-releasedmlv054wip/)
 *
 */
package boilerplate.client;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import cpw.mods.fml.common.network.IGuiHandler;

import boilerplate.api.IOpenableGUI;

/**
 * @author Surseance
 *
 */
public class GuiHandler implements IGuiHandler
{
	@Override
	public Object getServerGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z)
	{
		IOpenableGUI openableGUI = this.getOpenableGUI(player, world, x, y, z);
		return openableGUI != null ? openableGUI.getServerGuiElement(id, player, world, x, y, z) : null;
	}

	@Override
	public Object getClientGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z)
	{
		IOpenableGUI openableGUI = this.getOpenableGUI(player, world, x, y, z);
		return openableGUI != null ? openableGUI.getClientGuiElement(id, player, world, x, y, z) : null;
	}

	private IOpenableGUI getOpenableGUI(EntityPlayer player, World world, int x, int y, int z)
	{
		Object object = world.getTileEntity(x, y, z);
		ItemStack itemStack = player.getHeldItem();
		return object instanceof IOpenableGUI ? (IOpenableGUI) object
				: (itemStack != null) && (itemStack.getItem() instanceof IOpenableGUI) ? (IOpenableGUI) itemStack.getItem() : null;
	}
}
<commit_msg>GUI Handler now does Entities<commit_after>/**
 * This class was created by BrassGoggledCoders modding team.
 * This class is available as part of the Steamcraft 2 Mod for Minecraft.
 *
 * Steamcraft 2 is open-source and is distributed under the MMPL v1.0 License.
 * (http://www.mod-buildcraft.com/MMPL-1.0.txt)
 *
 * Steamcraft 2 is based on the original Steamcraft Mod created by Proloe.
 * Steamcraft (c) Proloe 2011
 * (http://www.minecraftforum.net/topic/251532-181-steamcraft-source-code-releasedmlv054wip/)
 *
 */
package boilerplate.client;

import boilerplate.api.IOpenableGUI;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

/**
 * @author Surseance
 *
 */
public class GuiHandler implements IGuiHandler
{
	@Override
	public Object getServerGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z)
	{
		IOpenableGUI openableGUI = this.getOpenableGUI(id, player, world, x, y, z);
		return openableGUI != null ? openableGUI.getServerGuiElement(id, player, world, x, y, z) : null;
	}

	@Override
	public Object getClientGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z)
	{
		IOpenableGUI openableGUI = this.getOpenableGUI(id, player, world, x, y, z);
		return openableGUI != null ? openableGUI.getClientGuiElement(id, player, world, x, y, z) : null;
	}

	private IOpenableGUI getOpenableGUI(int id, EntityPlayer player, World world, int x, int y, int z)
	{
		Entity entity = world.getEntityByID(id);
		TileEntity tileEntity = world.getTileEntity(x, y, z);
		ItemStack itemStack = player.getHeldItem();
		return entity instanceof IOpenableGUI ? (IOpenableGUI)entity : tileEntity instanceof IOpenableGUI ?
				(IOpenableGUI)tileEntity : (itemStack != null) && (itemStack.getItem() instanceof IOpenableGUI) ?
				(IOpenableGUI) itemStack.getItem() : null;
	}
}

{'fraction_non_alphanumeric': 0.10376398779247202, 'fraction_numerical': 0.011698880976602238, 'mean_word_length': 4.741605839416058, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '128018', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1267, 'n_words': 380}