How to save data from gui to block or item

Started by BlockyPenguin on

Topic category: Help with modding (Java Edition)

Last seen on 23:44, 7. Jan 2020
Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to save data from gui to block or item

Hi!

So I' making a mod where, when you right click on a block, the GUI opens. What I need is for the block to be able to get the text inputted from the GUI, and store it, either in an item given to the player, or in the block itself. Please bear in mind that the text may contains spaces and new lines. Is there any way of doing this?

TIA,

~Blocky

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't think it is possible…
Sat, 11/02/2019 - 08:32

I don't think it is possible yet :(

Last seen on 23:44, 7. Jan 2020
Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Aww ok. :( Thanks for saying…
Sat, 11/02/2019 - 10:47

Aww ok. :( Thanks for saying though.

Last seen on 17:49, 25. Mar 2021
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think you can, actually…
Mon, 11/04/2019 - 16:00

I think you can, actually. You can store the text input dependency then turn it into a string variable. But I don't know if are there nbt string variables too...

Last seen on 23:44, 7. Jan 2020
Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@RaolTheBest No, not as far…
Fri, 11/08/2019 - 08:49

@RaolTheBest No, not as far as I'm aware...

Last seen on 21:09, 30. Mar 2024
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
An string variable is now…
Thu, 03/26/2020 - 15:19

An string variable is now possible, i think.

Last seen on 14:42, 26. May 2020
Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Currently in MCreator 2020.2…
Sun, 03/29/2020 - 01:52

Currently in MCreator 2020.2 it is possible to do so, recently I did a similar test, and as now there is also a NBT tag for text, it is easy to store both in blocks and in items, the problem is that in the GUI you do not have the option to read the NBT tag text in case you need to display it in the GUI, however you can store the TextField text in an NBT text tag and even convert it to a number if you need to

Anyway, I did a simple procedure that takes the value of the string in the TextField and sends this value in the chat, the only way I managed to make it work is through a button that makes the middle of saving the value of the TextField in the NBT tag

procedure block