Shelf Slot Machine

The Best Slot Machine Using Shelfs!

Supported Versions:

1.21.8-1.21.9+

Commands by Row:

Row 1

1. [impulse] /scoreboard objectives add slot1 dummy

Row 2

2. [impulse] /scoreboard objectives add slot2 dummy

Row 3

3. [impulse] /scoreboard objectives add slot3 dummy

Row 4

4. [impulse] /scoreboard objectives add timer dummy

Row 5

5. [repeat] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 run scoreboard players add @s timer 1
6. [chain] /execute as @e[tag=slotMachine] at @s if block ~ ~-2 ~ lever[powered=true] run scoreboard players set @s timer 1
7. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 1..20 store result score @s slot1 run random value 1..5
8. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 21 run playsound minecraft:block.dispenser.dispense ambient @a ~ ~ ~ 2 1
9. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 1..40 store result score @s slot2 run random value 1..5
10. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 41 run playsound minecraft:block.dispenser.dispense ambient @a ~ ~ ~ 2 1
11. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 1..60 store result score @s slot3 run random value 1..5
12. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 61 run playsound minecraft:block.dispenser.dispense ambient @a ~ ~ ~ 2 1
13. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 80 if score @s slot1 = @s slot2 if score @s slot2 = @s slot3 run give @p diamond
14. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches 81 if score @s slot1 = @s slot2 if score @s slot2 = @s slot3 run playsound minecraft:ui.toast.challenge_complete ambient @a ~ ~ ~ 2 1
15. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..60 run playsound minecraft:entity.item_frame.add_item ambient @a ~ ~ ~ 1 1

Row 6

16. [repeat] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot1 matches 1 run data modify block ~ ~-1 ~ Items[{Slot:0b}].id set value "minecraft:coal"
17. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot1 matches 2 run data modify block ~ ~-1 ~ Items[{Slot:0b}].id set value "minecraft:iron_ingot"
18. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot1 matches 3 run data modify block ~ ~-1 ~ Items[{Slot:0b}].id set value "minecraft:gold_ingot"
19. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot1 matches 4 run data modify block ~ ~-1 ~ Items[{Slot:0b}].id set value "minecraft:emerald"
20. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot1 matches 5 run data modify block ~ ~-1 ~ Items[{Slot:0b}].id set value "minecraft:diamond"

Row 7

21. [repeat] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot2 matches 1 run data modify block ~ ~-1 ~ Items[{Slot:1b}].id set value "minecraft:coal"
22. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot2 matches 2 run data modify block ~ ~-1 ~ Items[{Slot:1b}].id set value "minecraft:iron_ingot"
23. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot2 matches 3 run data modify block ~ ~-1 ~ Items[{Slot:1b}].id set value "minecraft:gold_ingot"
24. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot2 matches 4 run data modify block ~ ~-1 ~ Items[{Slot:1b}].id set value "minecraft:emerald"
25. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot2 matches 5 run data modify block ~ ~-1 ~ Items[{Slot:1b}].id set value "minecraft:diamond"

Row 8

26. [repeat] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot3 matches 1 run data modify block ~ ~-1 ~ Items[{Slot:2b}].id set value "minecraft:coal"
27. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot3 matches 2 run data modify block ~ ~-1 ~ Items[{Slot:2b}].id set value "minecraft:iron_ingot"
28. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot3 matches 3 run data modify block ~ ~-1 ~ Items[{Slot:2b}].id set value "minecraft:gold_ingot"
29. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot3 matches 4 run data modify block ~ ~-1 ~ Items[{Slot:2b}].id set value "minecraft:emerald"
30. [chain] /execute as @e[tag=slotMachine] at @s if score @s timer matches ..100 if score @s slot3 matches 5 run data modify block ~ ~-1 ~ Items[{Slot:2b}].id set value "minecraft:diamond"

Preview

impulse
impulse
impulse
impulse
repeat
chain
chain
chain
chain
chain
chain
chain
chain
chain
chain
repeat
chain
chain
chain
chain
repeat
chain
chain
chain
chain
repeat
chain
chain
chain
chain

Video

Too lazy to copy and paste each command?