Jump to content

[1-15] [SOLVED] Blocks with two guis that are not communicating


matt1999rd

Recommended Posts

I am creating a toll gate in my mod. The objectives of this block is to allow a user coming in one side to pay and pass the toll gate when giving a certain amount of emerald. I want this amount to be equal to 1 by default and can be changed by a technician worker. I had problems with saving the price with capability when closing world. Of what I see I notice that my gui was on Render Thread and the INBTSerialisable function on Server Thread.

I am wandering what I could do to make sure the Capability work and gui also ?

Here is the code of my mod : https://github.com/matt1999rd/GatesMod/tree/master/src/main/java/fr/mattmouss/gates

All important code are in TollGateTileEntity, PriceStorage and all Class in gui repository and TollGate onBlockActivated

 

 

Link to comment
Share on other sites

yes I was sensing that the problem was from there :

2 hours ago, diesieben07 said:

You call lowerPrice and raisePrice on your TE from the client-side GUI screen. But they check for !isRemote again, so nothing will happen here. 

I made many change to fix the problem and before that there were no test for remote world.

Is containerScreen treated correctly ? because I used the code from the tutorial of mcjty for making it...

 

I need two gui for my mod and it seems to me that NetworkHook.openGui can open only one containerGui. For the techGui I will need a container gui (looking at an old topic about that) with two button and the display of the price. Is it possible to make a gui container without slot ?

Edited by matt1999rd
add a question
Link to comment
Share on other sites

1 hour ago, matt1999rd said:

Is containerScreen treated correctly ? because I used the code from the tutorial of mcjty for making it...

No, you are:

3 hours ago, diesieben07 said:
  • This makes zero sense. First you check that you are on the server (!isRemote), then you act like you are on the client and call Minecraft#displayGuiScreen.
  • You call lowerPrice and raisePrice on your TE from the client-side GUI screen. But they check for !isRemote again, so nothing will happen here.

You need to fix these problems, not just add random !isRemote checks and hope it works.

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.

Link to comment
Share on other sites

14 minutes ago, Draco18s said:

No, you are:

I think you are misunderstanding what I ask precisely because what I wanted to know is whether the usergui which use ContainerScreen is correctly done ?

For the rest I am actually correcting the problem.

For the second Draco18s do you thinks it is possible to have two container in one block with different registry name and without making the huge bugs ?

Link to comment
Share on other sites

4 hours ago, matt1999rd said:

what I wanted to know is whether the usergui which use ContainerScreen is correctly done ?

Yes, only because you're using a ContainerScreen with does all of the important stuff for you.

4 hours ago, matt1999rd said:

do you thinks it is possible to have two container in one block with different registry name and without making the huge bugs ?

Never done it.

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.

Link to comment
Share on other sites

thank you for your answer I have used packet to make the function and it works for Server Side as for client side it does not work but I think I can correct it by updating value in tick function am I right ?

I have a new problem the price is not displayed on the Techgui. I need to close and open the gui again to display the correct price

Edited by matt1999rd
Link to comment
Share on other sites

https://github.com/matt1999rd/GatesMod/commit/b9a62d4267ab9cdc71adc2cabe6dda830798e0a2

I have update the code on git hub

the function updatePrice is not the best solution I think

I solve the problem : I need to update the price on Client Side by using lowerPrice directly in the gui

Edited by matt1999rd
problem solved
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

59 minutes ago, diesieben07 said:

So what is your issue now?

this is done issue is completed thank you for all your replies

28 minutes ago, Draco18s said:

for that I have just copied the code from 10th mcjty tutorial 1.14 when he sent packet for spawning entities thank you for this correction. For me it may improve the sped of packet sending

Link to comment
Share on other sites

  • matt1999rd changed the title to [1-15] [SOLVED] Blocks with two guis that are not communicating
18 minutes ago, matt1999rd said:

For me it may improve the sped of packet sending

By about 400 nanos, maybe, by avoiding a couple of function call overheads.

(That's 0.0004 ms)

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.

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.



×
×
  • Create New...

Important Information

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