[SOLVED] GUI Item Conversion

Started by Alec Cature on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED] GUI Item Conversion
Tue, 12/12/2023 - 06:39 (edited)

I am attempting to make a GUI that allows me to convert a copper ingot into a copper coin by placing the ingot in slot 0 and the coin shows up in slot 1. However, when I attempt to do this using the "when slot contents change" procedure, it only updates every other ingot I place into it, and sometimes it bugs out and adds/removes an extra coin as well as shown in the linked video. Any idea how to fix this to work reliably?

- I do not want to use when "while this GUI is open tick" as this unnecessarily runs scripts repeatedly when all I need to do is detect for a slot change.
- I also do not want the copper ingot to instantaneously turn into a coin in the other slot like it does in the solution for this forum (https://mcreator.net/forum/100001/gui-item-converter), but instead work similar to a crafting table where both slots display an item, and you can remove one or the other if you change your mind.

Code I'm using:

Gif of my problem happening visually: https://media.giphy.com/media/ZvXYXRnRL2nn4DsFTc/giphy.gif

Edited by Alec Cature on Tue, 12/12/2023 - 06:39
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you need to set 'get number …
Tue, 12/12/2023 - 05:16

you need to set 'get number + X' i guess u just set 'get number' wont give your product ?

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure at all what you…
Tue, 12/12/2023 - 06:16

I'm not sure at all what you are suggesting/asking. May you clarify a bit?

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wait I just fixed it myself!…
Tue, 12/12/2023 - 06:38

Wait I just fixed it myself! The solution was to add a 1 tick delay in the procedure when it detects a change in the slot. I believe the reason for this is because its checking immediately when i add/remove something and doesn't give the game time to actually process how much, so sometimes it's a hit or miss on whether it registers the new addition into the slot or not.

I could be wrong about that reasoning, but regardless here's what I did in case anyone else has the problem.

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why don't you just use a…
Tue, 12/19/2023 - 18:59

Why don't you just use a recipe?

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Or if you want to keep a…
Tue, 12/19/2023 - 19:12

Or if you want to keep a procedure, you can do something like this:

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I made a mistake, in the…
Tue, 12/19/2023 - 20:03

I made a mistake, in the last part you want to define the output slot, so it looks like this:


Set (Get number of items from slot "1" of block x, y, z, if has inventory + "1") [coin] in slot "1" of block x, y, z, if it has inventory

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The reason I didn't use a…
Sun, 12/31/2023 - 06:43

The reason I didn't use a crafting recipe is cause I wanted a custom coin press work station to do the action of pressing ingots to coins, rather than assuming its handmade at a crafting bench or in the inventory GUI.

I'm also doubling the coin press as a way to convert coins to higher or lower tier currencies such as copper to silver, and vice versa. Doing so keeps all the coin-related tasks in one single organized block GUI for players to understand.

I do want to state that I appreciate the help you provided, however I have already solved the issue at hand as seen in the title. Thanks for the different perspective though!