<commit_before>package openblocks;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import openblocks.client.gui.GuiDevNull;
import openblocks.client.gui.GuiInfoBook;
import openblocks.client.gui.GuiLuggage;
import openblocks.common.container.ContainerDevNull;
import openblocks.common.container.ContainerLuggage;
import openblocks.common.entity.EntityLuggage;
import openmods.ItemInventory;
import openmods.Log;
import cpw.mods.fml.common.network.IGuiHandler;

public class OpenBlocksGuiHandler implements IGuiHandler {

	public static enum GuiId {
		luggage,
		infoBook,
		devNull;

		public static final GuiId[] VALUES = GuiId.values();
	}

	@Override
	public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
		final GuiId guiId = getGuiId(id);
		if (guiId == null) return null;

		switch (guiId) {
			case luggage:
				return new ContainerLuggage(player.inventory, (EntityLuggage)world.getEntityByID(x));
			case devNull:
				return new ContainerDevNull(player.inventory, new ItemInventory(player, 1));
			default:
				return null;
		}
	}

	@Override
	public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
		final GuiId guiId = getGuiId(id);
		if (guiId == null) return null;

		switch (guiId) {
			case luggage:
				return new GuiLuggage(new ContainerLuggage(player.inventory, (EntityLuggage)world.getEntityByID(x)));
			case infoBook:
				return new GuiInfoBook();
			case devNull:
				return new GuiDevNull((ContainerDevNull)getServerGuiElement(id, player, world, x, y, z));
			default:
				return null;
		}
	}

	private static GuiId getGuiId(int id) {
		try {
			return GuiId.VALUES[id];
		} catch (ArrayIndexOutOfBoundsException e) {
			Log.warn("Invalid GUI id: %d", id);
			return null;
		}<commit_msg>Fix possible crash<commit_after>package openblocks;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import openblocks.client.gui.GuiDevNull;
import openblocks.client.gui.GuiInfoBook;
import openblocks.client.gui.GuiLuggage;
import openblocks.common.container.ContainerDevNull;
import openblocks.common.container.ContainerLuggage;
import openblocks.common.entity.EntityLuggage;
import openmods.ItemInventory;
import openmods.Log;
import cpw.mods.fml.common.network.IGuiHandler;

public class OpenBlocksGuiHandler implements IGuiHandler {

	public static enum GuiId {
		luggage,
		infoBook,
		devNull;

		public static final GuiId[] VALUES = GuiId.values();
	}

	@Override
	public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
		final GuiId guiId = getGuiId(id);
		if (guiId == null) return null;

		switch (guiId) {
			case luggage:
				return new ContainerLuggage(player.inventory, (EntityLuggage)world.getEntityByID(x));
			case devNull:
				if (player.inventory.getCurrentItem() == null) return null;
				return new ContainerDevNull(player.inventory, new ItemInventory(player, 1));
			default:
				return null;
		}
	}

	@Override
	public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
		final GuiId guiId = getGuiId(id);
		if (guiId == null) return null;

		switch (guiId) {
			case luggage:
				return new GuiLuggage(new ContainerLuggage(player.inventory, (EntityLuggage)world.getEntityByID(x)));
			case infoBook:
				return new GuiInfoBook();
			case devNull:
				return new GuiDevNull((ContainerDevNull)getServerGuiElement(id, player, world, x, y, z));
			default:
				return null;
		}
	}

	private static GuiId getGuiId(int id) {
		try {
			return GuiId.VALUES[id];
		} catch (ArrayIndexOutOfBoundsException e) {
			Log.warn("Invalid GUI id: %d", id);
			return null;
		}
{'fraction_non_alphanumeric': 0.10024057738572574, 'fraction_numerical': 0.0005346164127238706, 'mean_word_length': 4.7129770992366415, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5211172', 'n_tokens_mistral': 1364, 'n_tokens_neox': 1228, 'n_words': 315}