Topic category: Help with Minecraft modding (Java Edition)
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
you need to set 'get number + X' i guess u just set 'get number' wont give your product ?
I'm not sure at all what you are suggesting/asking. May you clarify a bit?
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.
Why don't you just use a recipe?
Or if you want to keep a procedure, you can do something like this:
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
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!