• 1.2k views 0 today
  • save_alt 44 downloads
Compatibility
Minecraft 1.13
to version
Minecraft 1.21
Changes include
  • Functions
  • 1
  • 1
Fenix5fire
Lvl 18Journeyman System
1
Simple and well optimized UUID based RNG.
  • Supports values from 1 up to 100000000 (one hundred million).
  • Can be used both as a server utility and a library for other datapacks
  • English and Russian locales for built-in messages available.
  • No idea how well distribution is, but looks fine for me :D

Commands
/trigger roll set <max-value> - generates a random number up to <max-value> and broadcasts result.

/scoreboard players set <entity> roll - sets max value for any entity. For players it rolls instantly.
/function droll:user/roll - rolls a dice with set max value. Works for any entity. If max value is not set - result could be anything.

/scoreboard players set Server roll <max-value> - generates a random number up to <max-value> and broadcasts result as Server. Does not require any entity.

/scoreboard players set Locale DROLL.System <id> - Sets locale for broadcast messages. 0 is English (default) and 1 is Russian.

/function droll:uninstall - uninstalls the datapack (deletes all linked scoreboards)




For datapack developers
/function droll:lib/random - generates a random value. Value can be negative and stored until next RNG call.
/scoreboard players get Random DROLL.Random - get value generated by droll:lib/random


/function droll:lib/random_capped - generates a random value up to Max. Value is stored until next call.
/scoreboard players set Max DROLL.Random <max-value> - sets max value for next droll:lib/random_capped call.
/scoreboard players get RandomCapped DROLL.Random - get value generated by droll:lib/random_capped.


Delete "droll/user" folder in datapack if you dont need any built-in user commands with broadcasts. Uninstall datapack before deleting folder.

Datapack example usage
<...>
scoreboard players operation Max DROLL.Random = Player MaxRoll
function droll:lib/random_capped
scoreboard players operation Player OutputValue = RandomCapped DROLL.Random
<...>
<do your things>


System uses entity UUID for RNG, so it will be much less effective in a world with no entities spawning. Non-living entities do also work tho.

Datapack should work on any version since 1.13, but I have only tested it on 1.17.1 and 1.20.1 cuz other versions require different Java. Tell me if it doesn't work on your version.

More like this

  Have something to say?

Welcome