Text Fields Synchronizer

Published by 151chit on
Supported MCreator versions
2024.1
2024.2
Tags / plugin type
Templates
plugin_image
Downloads:
470
Upvotes: 7
About the plugin

This plugin allows you to synchronize text fields between the server and client.

I also didn't implement the procedures called by the "When the GUI is opened" trigger, because when the GUI is opened, the text in the text field will never be different from "".

Supported versions:

  • 1.16.5 (forge) 2024.1+ (with generator plugin for 1.16.5) Not fully tested
  • 1.18.2 (forge) 2023.1-2023.3
  • 1.19.2 (forge) 2023.1-2023.3
  • 1.20.1 (forge)
  • 1.20.4 (neoforge)
  • 1.20.6 (neoforge)

Supported components:

  • Procedure called by a button/image button
  • Procedure called every tick while the GUI is open
  • All 6 procedures called by slot interactions
  • Procedure called after GUI is closed
  • Boolean checkbox values
  • Setting values ​​in a text field:

                  1.All players (even external trigger)

                  2.To the player using an entity dependency (even an external trigger)                   

It adds new procedure blocks for reading the values ​​of checkboxes and text fields, and for setting the value of text fields:
procedure

setvalue

checkbox

When you click a button on the server, the client side writes all the values ​​of the text fields into a new hash map and sends it over the standard network packet of the mcreator button, in the network packet this hash map is combined with the guistate hash map from mcreator and the new procedure block can read it.

testing

The source code is the plugin itself.

In this case, an unlimited number of text fields and checkboxes is supported, but do not fill the text field to the maximum value, otherwise the network packet will exceed the permissible limit in bytes and you will be kicked from the server!

1.0

  • Plugin released.

1.1

  • Added synchronization of text fields for procedures called by slot interactions.
  • The "Every tick while the gui is open" trigger has been moved from the render method to the containerTick method to reduce the speed of the procedure and improve performance.

1.2

  • Added support for the "When GUI is closed" trigger.

1.3

  • Added a block for setting the value of a text field for a player (entity) or for all players for the currently open GUI for the server.

1.4

  • Added support for checkboxes (if the checkbox is checked).

1.5

  • Fixed a critical error leading to a ClassCastException when trying to press a button with a procedure when the trigger “when the gui is closed” or “every tick while the gui is open” is simultaneously attached to this procedure on 1.20.4 (neoforge).
  • 1.5.1: fixed a bug where the "every tick while the gui is open" trigger tried to call the textboxstart() method that was not intended for this purpose.

1.6

  • Added support for snapshot 2024.2, 2 GUI bug fixes (mouse cursor, slots and blocks) were also ported to NeoForge 1.20.4 (2024.1).

1.7

  • The plugin has been updated to version Mcreator 2024.2 and support for NeoForge 1.20.6 has been added.

1.8 

  • Methods for transmitting synchronized data over the network have been changed from utf to component.literal() .
  • 1.8.1:
  • Removed duplicate resize method.
Project members
Developer

Plugin downloads
Text Fields Synchronizer-1.4s (FOR 1.18.2 and 1.19.2 ONLY, 2023.1-2023.3) - old_textfield_sync.zipUploaded on: 07/29/2024 - 10:42   File size: 32.67 KB
Text Fields Synchronizer-1.8.1 - Textfields_sync_0.zipUploaded on: 08/26/2024 - 19:05   File size: 66.69 KB

Comments

ManyaDeath, do you mean a global trigger? just a button in the GUI can't be pressed in the sense that it will switch its boolean state to True like a checkbox does, it doesn't have such a function, and by the way I can't change or add anything to the GUI of the Mcreator mod element itself, I can only change the templates for automatic generation of the mod element code, which is enough for synchronization, if you are talking about the procedure that starts after releasing the GUI button similar to how it works in key bindings, then this is more related to modifying Mcreator itself than correcting its shortcomings in code generation

It's ok 141chit. I had a request about wanting a procedure to detect if a button is pressed from outside the procedure. There is support to run a procedure when button is clicked but I wanted a procedure like(is x button pressed in the currently open gui) I have many uses for this so it's my sincere request that you add this.

_Knifick, I don't think it's possible, synchronization is technically arranged in such a way that when the procedure is called, it packs all the text from all the fields and checkboxes into a network packet, and then this packet is sent over the network to the server, where it receives it and starts the procedure, when the procedure has already been started, and then on the server changed the fields for the client, then these changes will be reflected on the server again only when the procedure is called again, the only option will probably be to separately start the procedure on the server with the initial data and then reflect them on the client, because when you open the GUI, the user has not yet physically entered the data into the GUI, and they are always the same, accordingly, there is no point in synchronizing this procedure, it works exactly the same on the client without a plugin

You can add support for the trigger When the GUY is opened, I use it like this, first I wait for one tick from the server side so that everything has time to load, then I fill in the text fields and checkboxes with nbt block tags

ManyaDeath, I'm from another country, I don't speak English, I use Google Translate, and I'm not sure I can speak in Discord, and I've never installed or used Discord

Hello151chit I had wanted a help from you for a very important reason please join https://discord.com/invite/59Rhf3wP . I am the dev of cosmic horizons and am in dire need of some gui helps.

_Knifick, that's it, I added the new version 2024.2 32117 to the list of supported ones, now it should work

stella, it was probably the same problem, now it should work

Hi, I don't have any new procedures. Most likely this is due to the fact that when MCreator starts, it gives me an error that the version is incompatible with the plugin (I am using version 2024.2 and downloaded the plugin version 1.8.1)
https://imgur.com/a/hRB6I0H

Stella, also you should use a procedure block to get the text from the field with the caption "(for server)" and a server icon on the side instead of the standard block from mcreator

Stella, This is a very strange behavior, I downloaded this plugin, reinstalled it and checked, all its functions work properly, if your GUIs were created before installing this plugin, then you need to open them and re-save this mod element so that its code changes, you should see the field private final static HashMap<String, String> textstate = new HashMap<>(); of class <Name>Screen.java after the Player field for version 1.20.1 forge on Mcreator 2024.1.18518+, otherwise the error is related to its installation, it should be fully loaded: yes in settings > plugin management, try these actions and tell me again, I just have no ideas then, can you also tell me the types of procedures that are used with text fields?
https://imgur.com/a/X3ONo59
https://imgur.com/a/2ejyuQy
https://imgur.com/a/tiJbrQm

Hi, I really need this plugin! I am making a mod for my server specifically (1.20.1; MCreator 2024.1). I tried your Version 1.8.1 just now and my server still tells me the textfields are empty. I looked at the generated code and it still seems to be for client side... What did I do wrong?

ElgerElg, what types of procedures did you use in your GUIs, did you use procedures that are called every tick in the GUI, or did you set the text in the text field by the user every tick, it's just that usually it can only load the server if something is done with the text fields every tick, could you give a link to your mod jar file if possible? it's just that usually if the players don't have the GUI open, then my plugin doesn't work, the only thing I can assume is that you used a block to set the value of the text fields in the procedure for every tick

ElgerElg, that's it, I made it for 1.16.5 (1.8.1 without s), unfortunately I couldn't test it on the server because the network game button is inactive in 1.16.5, I tested it in a single player game, but I think it works because the data is transmitted via network packets and arrives, if it doesn't work write here, packing it into a zip archive took longer than porting the code

Hello! Sorry for not answering your posts for a while. Thanks for making this great addon to version Forge 1.16.5. I’m sure you will attract a lot of people to your development. I checked addon on the server (only checked textfields). Everything works fine! Thanks again <3

Hello great developer! I have a little problem. There are about 35-40 people who start to see a steady decrease in their TPS. I think it may well be my fashion with your addition. Is there such a case of TPS falling on your addon?

ElgerElg, At the moment all the code and files of the plugin are already done, but I'm trying to pack them into a zip archive and they don't want to pack, mcreator either doesn't see them, or Windows gives an archiving error, and I also can't reply to comments with the reason "There was a problem with your form submission. Please wait 6 seconds and try again."

ElgerElg, ok, i'll make a plugin for 1.16.5 somewhere this week

I use this amazing generator 1.16.5 for newer version of MCreator. Thank you for not forgetting and not stopping the development on old versions.
https://mcreator.net/plugin/96320/minecraft-forge-1165-mods-generator