Posted August 3, 20178 yr Hey, I'm running a Minecraft server with my mod currently. I have some custom Gui's that I've made for a few items in my mod. The Gui's open when I'm in a single player game, but they do not open when I'm on the server. I'm not sure how to debug this, and I followed several tutorials for how to make custom Gui's. Here's my GuiHandler.java class: public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); if (tileEntity != null) { if (ID == BlockHandler.GUI_ENUM.ALLOY_FURNACE.ordinal()) { return new ModContainerAlloyFurnace(player.inventory, (ModTileEntityAlloyFurnace)tileEntity); } else if (ID == BlockHandler.GUI_ENUM.CRAFTING_TABLE.ordinal()) { return new ModCraftingTable.InterfaceCraftingTable(world, new BlockPos(x, y, z)); } else if (ID == BlockHandler.GUI_ENUM.CAMPFIRE.ordinal()) { return new ModContainerCampfire(player.inventory, (ModTileEntityCampfire)tileEntity); } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); if (tileEntity != null) { if (ID == BlockHandler.GUI_ENUM.ALLOY_FURNACE.ordinal()) { return new ModGuiAlloyFurnace(player.inventory, (ModTileEntityAlloyFurnace)tileEntity); } else if (ID == BlockHandler.GUI_ENUM.CRAFTING_TABLE.ordinal()) { return new GuiCrafting(player.inventory, world, new BlockPos(x, y, z)); } else if (ID == BlockHandler.GUI_ENUM.CAMPFIRE.ordinal()) { return new ModGuiCampfire(player.inventory, (ModTileEntityCampfire)tileEntity); } } return null; } } Am I missing something? I have this piece of code in my ServerProxy.java (which is the common proxy) public void preInit() { GameRegistry.registerWorldGenerator(new OreGen(), 0); NetworkRegistry.INSTANCE.registerGuiHandler(ExpandedAesthetics.instance, new GuiHandler()); } Do I also need to put this in the Client Proxy? (Here's my github repo) Edited August 3, 20178 yr by DragonFerocity
August 3, 20178 yr https://github.com/DragonFerocity/expandedaesthetics/blob/master/src/main/java/com/DragonFerocity/expanded/blocks/ModAlloyFurnace.java#L172 That has to be called client-side too Also, this will always be true because of this line. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
August 3, 20178 yr 1 hour ago, Draco18s said: That has to be called client-side too No it doesn't. If IGuiHandler#getServerGuiElement returns a non-null Container, FML will send a packet to the client telling it to open the specified GUI. 2 hours ago, DragonFerocity said: I have this piece of code in my ServerProxy.java (which is the common proxy) public void preInit() { GameRegistry.registerWorldGenerator(new OreGen(), 0); NetworkRegistry.INSTANCE.registerGuiHandler(ExpandedAesthetics.instance, new GuiHandler()); } Do I also need to put this in the Client Proxy? It needs to be done on both physical sides. Proxies are for sided code, you don't need a "common" proxy. Anything that needs to be done on both physical sides should be done from your @Mod class (or a class called from it). Edited August 3, 20178 yr by Choonster Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 3, 20178 yr 9 hours ago, Choonster said: No it doesn't. If IGuiHandler#getServerGuiElement returns a non-null Container, FML will send a packet to the client telling it to open the specified GUI. My mistake, I looked at my own code and saw I was doing it on both sides and didn't investigate further. And it was midnight. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.