Started by
holidaupy
on
Topic category: Help with Minecraft modding (Java Edition)
So I'm making a feature where you click on a block and it replaces a specific item with another item. The only semi-sufficient solution I was able to find was removing the item and adding the replacement item. The issue with this is that when the first item can't be found in the in the player's inventory, it removes nothing and adds the replacement item anyways. No forums I've looked up have really helped, does anybody have any other ideas or a solution?
Create a procedure and use the global trigger "On player right clicks block"
The "set item in main-hand..." procedure block will remove/replace any item currently in the main hand.
It sounds to me that you are simply missing an "if item in main-hand" procedure.
Debugging Notes:
If you are trying to replace an item from anywhere in the inventory, your procedure will look a little more like this.