Started by
eithanz
on
Topic category: Help with Minecraft modding (Java Edition)
hey so i have a code for when you break a block with a certain tool, you get instead of the block a random number of another item, but i cant seem to get a code of
a random number so i can give the player 1-3 of the other item
if someone could help me by sending a code example of how to make a random number from 1-X it would be AMAZING
ty
If you want it to drop 1-3 of the item then you will need to use random[0,1]. Make a local variable and set it to random[0,1], Then make 3 if statements with if the local variable is over a certain amount (0, 0.333, 0.666 should work) then spawn a 'gem' of the specified item for each of them.
ty
You're welcome.
I have another method
Imagine _i is the resulting value
set _i to (round up ((random 0,1)*3))
Then check for _i if its 1 or 2 or 3.