Jump to content

Multiplayer GUI Problem


calclavia

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • @bluedisgusted That actually fully fixed it, thank you so much
    • Hi, I would like to know how to create multiple hitboxes for the player like the ender dragon. I've searched everywhere but I haven't found anything.
    • FOLKWIN EXPERT RECOVERY is the crypto hero we all need in the ongoing battle against cryptocurrency theft. With the rise in popularity of digital assets like Bitcoin and Ethereum, crypto crime has also been on the rise as hackers look to steal funds stored in virtual wallets. Many a crypto investor has fallen victim to clever scams and hacking schemes that drain wallets of their precious coins. But fear not, for FOLKWIN EXPERT RECOVERY has arrived as a beacon of hope for those who have had their hard-earned crypto stolen. This service is like a superhero for tracking down lost or stolen cryptocurrency, utilizing their advanced forensic technology and expertise to follow the blockchain paper trail and identify where your funds have gone. Their team of ethical hackers act like detectives, piecing together crypto transactions and unmasking the thieves behind complex cybercrimes. No case is too difficult for FOLKWIN EXPERT RECOVERY; they have recovered millions in stolen crypto assets from around the globe. Their mission is to reunite victims with their lost funds and bring criminals who prey on cryptocurrency investors to justice. With their help, those who have been robbed of their digital fortunes now have a crypto guardian to call upon in their time of need. FOLKWIN EXPERT RECOVERY gives victims the hope that all is not lost forever when crypto theft occurs.For support, Contact details is: TELEGRAM: @FOLKWIN_EXPERT_RECOVERY, EMAIL: FOLKWINEXPERTRECOVERY at TECH-CENTER dot COM, WEBSITE: WWW.FOLKWINEXPERTRECOVERY.COM .  are the heroes we need in the ongoing battle to make cryptocurrency ownership safe and secure for all. Get FOLKWIN EXPERT RECOVERY on your side when you have issues like this by dialing: Do this and thank me later. God Blessings to all, I'm forever grateful oh God for the successful recovery. I recommend FOLKWIN EXPERT RECOVERY the best ever and i'm so happy i got all my lost money back. Best Regards. Pamela K Ingram.
    • Made it work. As a note, one of the times it didn't recognize the recipe cause the MOD_ID constant I was using somewhere was NOT referencing my MOD_ID but rather another static variable with the same name. Maybe OP is having a similar problem
    • What exactly is the issue?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.