/** * Opens a Gui for the player. * * @param mod The mod associated with the gui * @param ID The ID number for the Gui * @param world The World * @param X X Position * @param Y Y Position * @param Z Z Position */ public void openGui(BaseMod mod, int ID, World world, int x, int y, int z) { if (!(this instanceof EntityPlayerMP)) { return; } EntityPlayerMP player = (EntityPlayerMP) this; if (!(mod instanceof NetworkMod)) { return; } IGuiHandler handler = MinecraftForge.getGuiHandler(mod); if (handler != null) { Container container = (Container) handler.getGuiElement(ID, player, world, x, y, z); if (container != null) { player.realGetNextWidowId(); player.closeCraftingGui(); PacketOpenGUI pkt = new PacketOpenGUI( player.getCurrentWindowIdField(), MinecraftForge.getModID((NetworkMod) mod), ID, x, y, z); player.playerNetServerHandler.sendPacket(pkt.getPacket()); craftingInventory = container; craftingInventory.windowId = player.getCurrentWindowIdField(); craftingInventory.onCraftGuiOpened(player); } } }