CurseForge · Minecraft mod
RandomLib
A library to create customizable random pools. Originally from the oneblock mod.
Quick answer
Which RandomLib release should I use?
randomlib-1.16.x-1.1.0.jar targets 1.16.5 with Forge. The project page does not say whether this file belongs on the client, dedicated server, or both. No extra mods listed for this file.
Where it goes
Is RandomLib required on the client, server, or both?
The project page does not say whether this file belongs on the client, dedicated server, or both.
The source does not explicitly classify this release as client-only or server-only.
What else does randomlib-1.16.x-1.1.0.jar need?
randomlib-1.16.x-1.1.0.jar. Change the file and its required mods may change too.
This file does not list any required mods. Do not add a library just because a different file uses it.
This file does not list any required or optional mods.
Before you install it
Add RandomLib without breaking your instance.
Built for randomlib-1.16.x-1.1.0.jar. Pick another file and the loader, install side or required mods may change.
- 01
Stick to this file
Use randomlib-1.16.x-1.1.0.jar. It targets 1.16.5 with Forge; another release may have different loader, side or dependency requirements.
- 02
Bring the mods it needs
This file does not list any required mods. Do not add a library just because a different file uses it.
- 03
Put it on the correct side
The project page does not say whether this file belongs on the client, dedicated server, or both.
- 04
Pick the file you checked
Use the “Get this file” button beside randomlib-1.16.x-1.1.0.jar. It opens that exact file at the source.
About this project
What does RandomLib add?
Originally a part of the One Block Plus mod, RandomLib is now a standalone library allowing your mod to create config files for weighted random generation.
Developer documentation. (WIP)
(This will likely be replaced later by a github repository)
RandomLibUtils.setup during FMLCommonSetupEvent to setup your config files.
<T extends ExtraData> RandomLibUtils.setup(ResourceLocation registryKey, Supplier<T> extra, Consumer<Map<String, RandomPool<T>>> afterDeserialization)
As an example, your config files will be generated in configs/oneblock/phases/ folder if registryKey = oneblock:phases.
extra is a supplier for an instance of an ExtraData implementation. This allows you to save more information about a random pool, in addition to the weighted items.
Once your config files are deserialized, they are saved in a map with their file name as a key but you likely would like to store them in a more convenient structure for your mod using the afterDeserialization consumer.
RandomLibUtils.registerCommand during FMLServerStartingEvent to setup a command to manage config files generated by RandomLib.
RandomLibUtils.registerCommand(FMLServerStartingEvent event, String commandname, ResourceLocation registryKey)
RandomLibUtils.registerCommand(FMLServerStartingEvent event, String commandname, ResourceLocation registryKey, ExtraDataCommand<? extends ExtraData> extraDataCommand)
registryKey is the same as for RandomLibUtils.setup
extraDataCommand completes brigadier for your ExtraData implementation.
RandomPool#getExtra() to get your deserialized ExtraData.
RandomPool#getRandom()#generateAndReplace(ServerWorld, BlockPos) to destroy block and generate an item from the random pool in the given world at the given position.
RandomPool#getRandom()#generate(ServerWorld, BlockPos) to generate an item from the random pool in the given world at the given position.
RandomPool#getRandom()#vgenerate(RandomContainer, ServerWorld, BlockPos, ItemStack) to generate an item from the random pool for an object implementing RandomContainer (likely a tile entity) in the given world at the given position and for the given held item (if any).
User documentation. (WIP)
Help command : /<RandomLib command name for this mod> help
example:

Project description from CurseForge.
Pick your setup
RandomLib by Minecraft version and loader
Choose the version and loader you play, then open the matching release.
Check the dependencies, then try the file in a copied instance before changing a world you care about.
Recent files
RandomLib versions and loaders
randomlib-1.16.x-1.1.0.jar
26 Dec 2024
randomlib-1.16.x-1.0.0.jar
25 Mar 2022
Looking for an older file? The official CurseForge project page is in Resources.