(Tutorial) Synchronizing text fields with the server. MCreator 2024.1

Started by 151chit on

Topic category: User side tutorials

Last seen on 19:29, 11. May 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(Tutorial) Synchronizing text fields with the server. MCreator 2024.1
Thu, 05/09/2024 - 16:07 (edited)

Before you begin, make sure that:

1)your procedure is completely written and will not change dependencies after synchronization is performed

2)Your gui is completely ready to work and does not require additional changes, since its code will be locked

3)you have at least one button that runs a procedure that reads the text of the text field

Steps

1)lock code of your GUI

2)open <your gui name>Screen.java class

3)find 2 lines of code starting with:

 PacketDistributor
<your gui name >ButtonMessage

 and add after the coordinates <your textbox name >.getValue()

<guiname>Screen.java

4)save <guiname>Screen.java file and open <guiname>ButtonMessage.java

5)in the button network package, after each line with coordinate information (Int), add information about the text in your text field (String / Utf {for buffer }) in the same way as the line with coordinates, replacing only the names and data type

<guiname>ButtonMessage.java

6) save <guiname>ButtonMessage.java (network packet) and open your procedure in blockly

7)replace broken block "get text inside textfield" to your custom text dependency of String <dependency> = <textboxname>

procedure

8)save procedure and check result on server

server check

NOTE

1)In version 1.20.1 mcreator 2023.4 the names of the lines of code are slightly different, but if you can basicly understand the code and add a string near the int, you can do this on version 1.20.1

2)I don’t know Java at all and I don’t know how to program, I discovered this completely by accident while experimenting with the network package and it may not work on some versions, and I haven’t tried fabric

Edited by 151chit on Thu, 05/09/2024 - 16:07
Last seen on 19:29, 11. May 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oops, I probably posted this…
Wed, 05/08/2024 - 19:39

oops, I probably posted this in the wrong section...

Last seen on 19:29, 11. May 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if in PacketDistributor…
Wed, 05/08/2024 - 19:44

if in PacketDistributor.SERVER.noArg().send(new TestsyncButtonMessage(0, x, y, z, textbox.getValue()));
TestsyncButtonMessage.handleButtonAction(entity, 0, x, y, z, textbox.getValue());
you don’t have 0, but 1 2, etc., this is normal, this is the ID of your buttons, you need to find your button among them, this can be found in the button message network package, each digit corresponds to the procedure

Last seen on 22:27, 19. May 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hmmmphmmm.... Step one…
Tue, 05/14/2024 - 17:50

hmmmphmmm.... Step one..... Step one........ Hmmphpmmmm... Oh my brain