Posted March 9, 20205 yr 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
March 9, 20205 yr Author 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 March 9, 20205 yr by matt1999rd add a question
March 9, 20205 yr 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.
March 9, 20205 yr Author 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 ?
March 10, 20205 yr 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.
March 10, 20205 yr Author 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 March 10, 20205 yr by matt1999rd
March 10, 20205 yr Author 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 March 10, 20205 yr by matt1999rd problem solved
March 10, 20205 yr Author Ok I have change a little bit my work I update it on Git Hub it does not use isRemote for test. I add some staff in the TechGui to change pric on client side after sending packet you can check for it on git hub :here
March 10, 20205 yr https://github.com/matt1999rd/GatesMod/blob/master/src/main/java/fr/mattmouss/gates/network/PacketRaisePrice.java#L32 Holy Jesus. That line can be simpler. Why do you get a world, get a server, get a world? You already HAD a world. https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/industry/network/ToServerFilterClick.java#L52 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.
March 10, 20205 yr Author 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: https://github.com/matt1999rd/GatesMod/blob/master/src/main/java/fr/mattmouss/gates/network/PacketRaisePrice.java#L32 Holy Jesus. That line can be simpler. Why do you get a world, get a server, get a world? You already HAD a world. https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/industry/network/ToServerFilterClick.java#L52 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
March 10, 20205 yr 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.
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.