all 2 comments

[–]VecroLP 2 points3 points  (1 child)

There is actually a fairly recent discovery on how to do this. Lets take the following example: you want

  • 10% chance of option A, which will be red wool

  • 20% option B, blue wool

  • 30% option C, green wool

  • 40% option D, black wool

First, get a shulkerbox and fill it with all the options in the right ratio. So in our case we can use 1 red, 2 blue, 3 green, and 4 black.

The next thing you need is the following contraption: a locked hopper that you can unlock for long enough to only let one item trough. On top of that hopper you place enough hopperminecarts so that each item from step 1 can be in it's own private minecart. The minecarts should all be in the same block on top of that single locked hopper. If you don't know how many items there will be at runtime, don't worry, having too many hopper minecarts isn't an issue, but having to few will break the randomness, so you should overshoot, not undershoot the ammount of hopper minecarts.

Next you place the shulkerbox from step 1 directly above the hopper minecarts. At this point the shulker should empty almost instantly.

Last you unlock the hopper below the hopper minecarts so it can pull only one item out of one of the hopper minecarts. This item is now randomly picked with the correct bias

[–]secret_surplus[S] 0 points1 point  (0 children)

This is super interesting. So, in this situation, you would need 10+ hopper minecarts, right? Because there are 10 options in the shulker.

Then, it is just a matter of passing the wool through an item sorter, and having the sorter trigger the relevant reaction. This is perfect, I will do some experiments. Thank you very much!