{
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
if (entityPlayer instanceof EntityPlayerMP)
{
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer;
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
if (remoteGuiContainer != null)
{
entityPlayerMP.getNextWindowId();
entityPlayerMP.closeContainer();
int windowId = entityPlayerMP.currentWindowId;