How do I make an item that when right clicked it has a chance to give you another item

Started by AxelotlTTV on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make an item that when right clicked it has a chance to give you another item

Is there a way to make an item that when right clicked has the chance to give you another item?

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Go to the "Triggers" tab on…
Mon, 03/17/2025 - 19:24

Go to the "Triggers" tab on your item's settings.

Create a new procedure and set it to trigger "When right-clicked."

Inside the procedure, do the following:

Generate a random number between 0 and 1 (this will act as the probability check).

Compare this number to a chosen threshold. For example, if you set the threshold to 0.7, then any number below 0.7 (70% of the time) will result in the player receiving an item.

Adjust this threshold to control the drop chance. (example: 0.1 is a 10% chance, 0.2 is a 20% chance, 0.3 is a 30% chance... and so on)

https://imgur.com/gallery/procedure-wlf79T5