Started by
AxelotlTTV
on
Topic category: Help with Minecraft modding (Java Edition)
Is there a way to make an item that when right clicked has the chance to give you another item?
Topic category: Help with Minecraft modding (Java Edition)
Is there a way to make an item that when right clicked has the chance to give you another item?
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