A small library built as a Quilt mod which gives modders access to Unsafe (both the sun one and the jdk internal one, assuming it's exported at compile time) and easily supports runtime module exporting and trusted MethodHandles.Lookup calls.
Current features
Unsafe.sun()for asun.misc.UnsafeinstanceUnsafe.jdk()for ajdk.internal.misc.Unsafeinstance (needs export — see below)Unsafe.lookup()for the trustedMethodHandles.Lookupinstance- Field getting and setting with force
- Enum widening
- Function accessor for allowing runtime use of JDK's internal ASM copy
- Shortcut methods for getting
MethodHandleinstances through the trusted lookup - Runtime module exporting / opening
- Forceful SecurityManager setting
Exporting modules
At runtime, call ModuleWidener.exportModule with either a class in the requested package, a class in the module and a string of the package, or the module instance and a string of the package.
At compile time, use javac compile arguments:
tasks.withType(JavaCompile).configureEach {
it.options.compilerArgs << "addExports" << "TheModuleGoesHere/ThePackageToExport=ALL-UNNAMED"
// This cannot be used with the release field. Instead use source / target compatibility fields in the java object.
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 21w19a, 21w20a, 1.17-pre1
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Modrinth — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Verified by MCModsHub
- Ships as quilt-but-less-okay-0.2.0.jar — drop this file into the mods folder
- Download size: 35 KB
- Download link checked 31 Aug 2026 — working
These come from our own check of the pack file, not from the source page.