

A mod for Megabonk that allows you to force rarity for chests and Moai.
| Key | Action |
|---|---|
| F1 | Toggle forced rarity ON/OFF |
| F2 | Toggle sound effects ON/OFF |
| Mouse Wheel Up | Next rarity (Common → Uncommon → Rare → Legendary) |
| Mouse Wheel Down | Previous rarity (Legendary → Rare → Uncommon → Common) |
RarityForce in the mod managerRarityForce.dll into BepInEx/plugins/ folderClone the repository:
git clone https://github.com/worldspawn-web/rarity_force.git
cd rarity_force
Copy required DLLs from your Megabonk installation to libs/ folder:
BepInEx/core/BepInEx.Core.dllBepInEx/core/BepInEx.Unity.IL2CPP.dllBepInEx/core/0Harmony.dllBepInEx/core/Il2CppInterop.Runtime.dllBepInEx/interop/UnityEngine.dllBepInEx/interop/UnityEngine.CoreModule.dllBepInEx/interop/Assembly-CSharp.dllBepInEx/interop/Il2Cppmscorlib.dllBuild the project:
dotnet build -c Release
Or use the build script:
build.bat./build.shThe compiled DLL will be in bin/Release/net6.0/RarityForce.dll
The mod uses Harmony to patch the game's GetItemRarity method. When forced rarity is enabled (F1), it overrides the game's random rarity selection with your chosen rarity.
Technical Details:
Assets.Scripts.Inventory__Items__Pickups.Rarity.GetItemRarity()Task.Run() to prevent game freezing