Posted June 6, 201411 yr I'm sure I'm doing something wrong that is very obvious but I can't see it. I put a print command on both sides of my GUIHandler and when I tell the server to open the GUI, its not communicating with the client. I can of course force the client side to open, but then they don't talk and wierd stuff happens. GUIHandler (#3 is the one of interest) public class MyGuiHandler implements IGuiHandler { public MyGuiHandler() { } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //System.out.println("Tried GUI server for " + ID); // Get Tile Entity PortalMulti_Tile npc_spawner_tile = (PortalMulti_Tile) world.getTileEntity(x, y, z); // determine case if exists if (npc_spawner_tile != null) { switch (ID) { case 1: break; case 2: break; case 3: return new MyContainer(player); } } // Default return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //System.out.println("Tried GUI client for " + ID); // determine case switch (ID) { case 1: return new Overworld_GUI(player, world, x, y, z); case 2: return new Protection_Admin_GUI(player, world, x, y, z); case 3: return new MyInventory(new MyContainer(player)); } // Default return null; } } Main class - well the relevant parts @Mod(modid = Dimension_Multiplyer.modid, name = Dimension_Multiplyer.name, version = Dimension_Multiplyer.version) public class Dimension_Multiplyer { // Setup Mod Details public static final String modid = "dimension_multiplyer"; public static final String name = "Dimension Multiplyer"; public static final String version = "1.2"; public static final String pre_path = "clandoolittle.dimension_multiplyer"; // Setup Intance @Instance(modid) public static Dimension_Multiplyer instance; @EventHandler public void Init(FMLInitializationEvent event) { myguihandler = new MyGuiHandler(); NetworkRegistry.INSTANCE.registerGuiHandler(this, myguihandler); } Called on serverside to open the GUI player.openGui(instance, guiID, player.worldObj, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ)); Long time Bukkit & Forge Programmer Happy to try and help
June 6, 201411 yr Author I probably didn't explain enough I am sending a packet to the server with a keybinder. It works, I'm tracking it with a print. It causes the serversideGUI call to happen (the systemprint shows it), but the client one never happens. I'm not sure about your null comment. That only happens if there isn't a ID specified, and in this case I specified 3. Long time Bukkit & Forge Programmer Happy to try and help
June 6, 201411 yr Author Well crud, it is getting to null. added another print statement. Long time Bukkit & Forge Programmer Happy to try and help
June 6, 201411 yr Author Thanks, it was the line if (npc_spawner_tile != null) { Forgot to remove that when i copied it out of another spot. Long time Bukkit & Forge Programmer Happy to try and help
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.