RarityForce
Allows to force rarity for Moai and Chests. Controls: [F1] - toggle force, [F2] - toggle sounds, [Mouse Wheel] - cycle rarity.
| Last updated | a day ago |
| Total downloads | 101 |
| Total rating | 1 |
| Categories | Mods Tools |
| Dependency string | bihop-RarityForce-1.1.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack_IL2CPP
BepInEx pack for IL2CPP x64 Unity games. Preconfigured and ready to use.
Preferred version: 6.0.738README
Rarity Force
A mod for Megabonk that allows you to force rarity for chests and Moai.
Controls
| 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) |
📋 Requirements
- Megabonk (Steam version)
- BepInEx 6.0.0+ (Unity IL2CPP version)
Installation
Automatic (Recommended)
- Install r2modman or Thunderstore Mod Manager
- Search for
RarityForcein the mod manager - Click "Install"
- Launch the game through the mod manager
Manual
- Download and install BepInEx 6.0.0+ IL2CPP for your game
- Run the game once to generate BepInEx folders
- Download the latest release from Thunderstore or GitHub Releases
- Extract
RarityForce.dllintoBepInEx/plugins/folder - Launch the game
Building from Source
-
Clone 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.dll
-
Build the project:
dotnet build -c ReleaseOr use the build script:
- Windows:
build.bat - Linux/Mac:
./build.sh
- Windows:
-
The compiled DLL will be in
bin/Release/net6.0/RarityForce.dll
How It Works
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:
- Patches
Assets.Scripts.Inventory__Items__Pickups.Rarity.GetItemRarity() - Uses reflection to access Unity's Input system for IL2CPP compatibility
- Asynchronous sound playback via
Task.Run()to prevent game freezing