📚 Bookshelf is a modular library datapack designed to simplify complex systems in Minecraft maps. Ideal for mapmakers looking for easy-to-implement tools.
This domain is sufficiently small that simply hardcoding all 13 outputs is faster and more obvious than the looping approach currently implemented.
execute if score $math.factorial.n bs.in matches 0 run return run scoreboard players set $math.factorial bs.out 1
execute if score $math.factorial.n bs.in matches 1 run return run scoreboard players set $math.factorial bs.out 1
execute if score $math.factorial.n bs.in matches 2 run return run scoreboard players set $math.factorial bs.out 2
execute if score $math.factorial.n bs.in matches 3 run return run scoreboard players set $math.factorial bs.out 6
execute if score $math.factorial.n bs.in matches 4 run return run scoreboard players set $math.factorial bs.out 24
execute if score $math.factorial.n bs.in matches 5 run return run scoreboard players set $math.factorial bs.out 120
execute if score $math.factorial.n bs.in matches 6 run return run scoreboard players set $math.factorial bs.out 720
execute if score $math.factorial.n bs.in matches 7 run return run scoreboard players set $math.factorial bs.out 5040
execute if score $math.factorial.n bs.in matches 8 run return run scoreboard players set $math.factorial bs.out 40320
execute if score $math.factorial.n bs.in matches 9 run return run scoreboard players set $math.factorial bs.out 362880
execute if score $math.factorial.n bs.in matches 10 run return run scoreboard players set $math.factorial bs.out 3628800
execute if score $math.factorial.n bs.in matches 11 run return run scoreboard players set $math.factorial bs.out 39916800
execute if score $math.factorial.n bs.in matches 12 run return run scoreboard players set $math.factorial bs.out 479001600
This runs fewer commands than the current implementation for all legal inputs
The factorial function is documented to only work in the range 0-12.
This domain is sufficiently small that simply hardcoding all 13 outputs is faster and more obvious than the looping approach currently implemented.
This runs fewer commands than the current implementation for all legal inputs