<commit_before>package com.creativemd.littletiles.client.gui.handler;

import com.creativemd.creativecore.common.gui.container.SubContainer;
import com.creativemd.creativecore.common.gui.container.SubGui;
import com.creativemd.creativecore.common.gui.opener.CustomGuiHandler;
import com.creativemd.creativecore.common.gui.opener.GuiHandler;
import com.creativemd.littletiles.common.action.LittleAction;
import com.creativemd.littletiles.common.action.LittleActionException;
import com.creativemd.littletiles.common.tiles.LittleTile;
import com.creativemd.littletiles.common.tiles.vec.LittleTileIdentifierAbsolute;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class LittleGuiHandler extends CustomGuiHandler {
	
	public static void openGui(String id, NBTTagCompound nbt, EntityPlayer player, LittleTile tile) {
		new LittleTileIdentifierAbsolute(tile).writeToNBT(nbt);
		
		GuiHandler.openGui(id, nbt, player);
	}
	
	public abstract SubContainer getContainer(EntityPlayer player, NBTTagCompound nbt, LittleTile tile);
	
	@Override
	public SubContainer getContainer(EntityPlayer player, NBTTagCompound nbt) {
		try {
			return getContainer(player, nbt, LittleAction.getTile(player.world, new LittleTileIdentifierAbsolute(nbt)));
		} catch (LittleActionException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@SideOnly(Side.CLIENT)
	public abstract SubGui getGui(EntityPlayer player, NBTTagCompound nbt, LittleTile tile);
	
	@Override
	@SideOnly(Side.CLIENT)
	public SubGui getGui(EntityPlayer player, NBTTagCompound nbt) {
		try {
			return getGui(player, nbt, LittleAction.getTile(player.world, new LittleTileIdentifierAbsolute(nbt)));
		} catch (LittleActionException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}<commit_msg>Fixed tile gui not taking care of subworld<commit_after>package com.creativemd.littletiles.client.gui.handler;

import java.util.UUID;

import com.creativemd.creativecore.common.gui.container.SubContainer;
import com.creativemd.creativecore.common.gui.container.SubGui;
import com.creativemd.creativecore.common.gui.opener.CustomGuiHandler;
import com.creativemd.creativecore.common.gui.opener.GuiHandler;
import com.creativemd.creativecore.common.world.CreativeWorld;
import com.creativemd.littletiles.common.action.LittleAction;
import com.creativemd.littletiles.common.action.LittleActionException;
import com.creativemd.littletiles.common.entity.EntityAnimation;
import com.creativemd.littletiles.common.events.LittleDoorHandler;
import com.creativemd.littletiles.common.tiles.LittleTile;
import com.creativemd.littletiles.common.tiles.vec.LittleTileIdentifierAbsolute;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class LittleGuiHandler extends CustomGuiHandler {
	
	public static void openGui(String id, NBTTagCompound nbt, EntityPlayer player, LittleTile tile) {
		new LittleTileIdentifierAbsolute(tile).writeToNBT(nbt);
		if (tile.te.getWorld() instanceof CreativeWorld)
			nbt.setString("uuid", ((CreativeWorld) tile.te.getWorld()).parent.getUniqueID().toString());
		GuiHandler.openGui(id, nbt, player);
	}
	
	public World getWorld(NBTTagCompound nbt, EntityPlayer player) {
		if (nbt.hasKey("uuid")) {
			EntityAnimation animation = LittleDoorHandler.getHandler(player.world).findDoor(UUID.fromString(nbt.getString("uuid")));
			if (animation != null)
				return animation.fakeWorld;
			throw new RuntimeException("Could not find world " + nbt.getString("uuid"));
		}
		return player.world;
	}
	
	public abstract SubContainer getContainer(EntityPlayer player, NBTTagCompound nbt, LittleTile tile);
	
	@Override
	public SubContainer getContainer(EntityPlayer player, NBTTagCompound nbt) {
		try {
			return getContainer(player, nbt, LittleAction.getTile(getWorld(nbt, player), new LittleTileIdentifierAbsolute(nbt)));
		} catch (LittleActionException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@SideOnly(Side.CLIENT)
	public abstract SubGui getGui(EntityPlayer player, NBTTagCompound nbt, LittleTile tile);
	
	@Override
	@SideOnly(Side.CLIENT)
	public SubGui getGui(EntityPlayer player, NBTTagCompound nbt) {
		try {
			return getGui(player, nbt, LittleAction.getTile(getWorld(nbt, player), new LittleTileIdentifierAbsolute(nbt)));
		} catch (LittleActionException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
{'fraction_non_alphanumeric': 0.09982751185855972, 'fraction_numerical': 0.0, 'mean_word_length': 6.237129485179407, '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': '379623', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1448, 'n_words': 267}