Posted June 16, 201213 yr I can't get the GUI to open on the blocks. I am not sure how to do this. I read the FML porting tutorial. I have this in both server and client and I registered it via MinecraftForge.setGuiHandler(this, this); @Override public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { System.out.println("WORKING "+ID); return null; } On the blockActivated function I simply called ModLoader.openGUI(...) in both client and server side. It never prints that line. Not sure why... You can check out the full code here: https://github.com/calclavia/Universal-Electricity/tree/master/Universal_Electricity Changes are in UCBlockMachine, mod_UniversalElectricity http://calclavia.com/uploads/banner.png[/img]
June 16, 201213 yr Use Player.openGui() like you should. ModLoader's openGUI is only clientside ever. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 17, 201213 yr Author Use Player.openGui() like you should. ModLoader's openGUI is only clientside ever. So in other words in the client side I use ModLoader.openGUI and on the server side on use Player.openGUI? Or is it both sides I use player.openGUI? http://calclavia.com/uploads/banner.png[/img]
June 17, 201213 yr Both sides you use Player.openGUI Try reading the IGuiHandler. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 17, 201213 yr Author Both sides you use Player.openGUI Try reading the IGuiHandler. Thanks! It works now! Is it possible to have more than one GUI handler in a mod? It doesn't really feel neat if I have all my GUIs handled at one location. But if there is no option, that is fine. That is just for coding aesthetics. One more question though. My tile entity saves NBT data and stuff. How do I make sure those datas are synced with the client? Or are they synced automatically themselves when I do an NBT save? http://calclavia.com/uploads/banner.png[/img]
June 17, 201213 yr packets or dataWatchers work for Mobs http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
June 17, 201213 yr Author Both sides you use Player.openGUI Try reading the IGuiHandler. OK. I accidentally lied. The GUI still doesn't open up on multiplayer. I am not sure what I am doing wrong. I have both server and client using IGuiHandler. I have ONLY the client doing action with the IGUIHandler because the server can not have a GUI class inside of it. Here are the sources. Scroll to the very bottom for the GUI handle function. CLIENT GUI HANDLER: https://github.com/calclavia/Universal-Electricity/blob/master/minecraft/net/minecraft/src/universalelectricity/components/UniversalComponents.java SERVER GUI HANDLER: https://github.com/calclavia/Universal-Electricity/blob/master/minecraft_server/net/minecraft/src/mod_UniversalElectricity.java http://calclavia.com/uploads/banner.png[/img]
June 17, 201213 yr The server needs to return a Container. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 18, 201213 yr Author The server needs to return a Container. Thanks it works now. http://calclavia.com/uploads/banner.png[/img]
June 18, 201213 yr Author I have another problem now though. The data of the tile entity seems to not be syncing with the server. I did some print line tests and the server had all the variables set correctly, but on the client side the variables are not correct. How would I make sure those variables in the tile entities are synced? EDIT: I tried using packets to send the data. But things start to get really messy. Is there any structured way I can send data packets? http://calclavia.com/uploads/banner.png[/img]
June 18, 201213 yr Not sure if it works with tileEntities but dataWatchers are used to sync data with mobs. Look at the villager class http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
June 18, 201213 yr Author I got all the packt working with some closes I created via UEPacketManager and UEIPacketReciever. Thanks for the help. http://calclavia.com/uploads/banner.png[/img]
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.