Text Fields Synchronizer

Published by 151chit on
Supported MCreator versions
2024.1
2024.2
2024.3
Tags / plugin type
Templates
plugin_image
Downloads:
852
Upvotes: 10
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)
  • 1.21.1 (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.

1.9

  • The plugin has been updated to version Mcreator 2024.3 and support for NeoForge 1.21.1 has been added.
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.zip Uploaded on: 07/29/2024 - 10:42   File size: 32.67 KB
Text Fields Synchronizer-1.9 - Textfields_sync_0.zip Uploaded on: 10/30/2024 - 13:25   File size: 83.54 KB

Comments

I seem to have done read/writeComponent() for my network packets on versions 1.20.1, 1.20.4, and for 1.20.6 I
used net.minecraft.network.chat.ComponentSerialization, in 1.20.6 the read/writeComponent() methods were removed and replaced with the ComponentSerialization class even in vanilla 1.20.6 packages, for example ClientboundDisconnectPacket

now I'll try to convert everything from UTF to component.literal

nerdy, The problem is that at the time of writing this comment you had not updated your plugin to 1.20.6 and there the read/writeComponent() methods were replaced with ComponentSerialization, like this:
private static Component readComponent(RegistryFriendlyByteBuf buffer) {
return ComponentSerialization.TRUSTED_STREAM_CODEC.decode(buffer);
}

private static void writeComponent(RegistryFriendlyByteBuf buffer, Component component) {
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buffer, component);
} and I will have to use them in new versions

strange but I can’t find the writeComponent() and readComponent() methods in the FriendlyByteBuf class, if you’re talking about the network package for neoforge version 1.20.6

nerdy, could you please clarify which methods should I do this?

urielito 3010, I’m unlikely to be able to do this since I don’t have enough willpower for this + the mcreator developers made it clear that text fields are only for the client by labeling this bug in Github “works as designed” several years ago

Thank you, sync mods are great, you should consider making a PR for actual mcreator with this

Hi, I found a bug with your plugin. So if there is a "While GUI is Open Tick" or a "When GUI is Closed" trigger with a procedure attached to it, and there is a button with a procedure also attached to it, when you press the button it will crash the game. The error message is here: https://pastebin.com/yEjp6s03

Can you either make this compatible with 1.18.2? Or maybe share how you did it? Thank you!