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

Started by 151chit on

Topic category: User side tutorials

Last seen on 21:05, 2. Jun 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 21:05, 2. Jun 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 21:05, 2. Jun 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 10:11, 1. Jun 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 

 

 

Last seen on 08:31, 2. Jun 2024
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@151chit Thank you very much…
Sat, 05/25/2024 - 15:34

@151chit Thank you very much for this tutorial.
I took the liberty of making a tutorial video on my Youtube channel (In French):

https://www.youtube.com/watch?v=sN9mlpU7MeI&lc=Ugybp_ZG-R9cQFL8dnJ4AaABAg

And in my series on creating plugins for MCreator, I will show how to transform it into a plugin.

Last seen on 21:05, 2. Jun 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I wrote a plugin for…
Fri, 05/31/2024 - 15:05

I wrote a plugin for Minecraft versions 1.20.1 forge and 1.20.4 neoforge, which does this automatically with an arbitrary number of text fields and with support for the trigger “every tick while the gui is open”, with the addition of a new block of procedures for reading text fields for the server: https://mcreator.net/plugin/107077/text-fields-synchronizer