
Modrinth · Minecraft mod
NativeLoader
A Fabric mod which allows you to use native code (like C++, C# NativeAOT) to modify the game, using JNA and JNI
Quick answer
Which NativeLoader release matches 1.20.5 Fabric?
NativeLoader 0.7.4 targets 1.20.4, 1.20.5, 1.20.6 with Fabric. Installation on the client is optional. Installation on the dedicated server is optional. No extra mods listed for this file.
Where it goes
Is NativeLoader required on the client, server, or both?
Installation on the client is optional. Installation on the dedicated server is optional.
The source marks this as usable on both the client and server.
What else does NativeLoader 0.7.4 need?
0.7.4 on 1.20.5 Fabric. Every mod below is checked against that same setup.
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 NativeLoader without breaking your instance.
Built for NativeLoader 0.7.4 on 1.20.5 Fabric. Pick another file and the loader, install side or required mods may change.
- 01
Stick to this file
Use 0.7.4. It targets 1.20.4, 1.20.5, 1.20.6 with Fabric; 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
Installation on the client is optional. Installation on the dedicated server is optional.
- 04
Pick the file you checked
Use the “Get this file” button beside 0.7.4. It opens that exact file at the source.
About this project
What does NativeLoader add?
English
NativeLoader is a compatibility-layer Fabric mod designed to modify game content in languages that can be compiled to native code except Java or Kotlin. It interacts with native code via JNI and JNA, giving native code enough flexibility and minimizing performance overhead.
Use
NativeLoader itself is only responsible for calling native code and providing wrapper classes, and does not modify the game content, you need to use other languages that can be compiled to native code and publish them as dll/so/dylib to actually modify the game
It is often necessary to use third-party libraries when writing code, which can avoid causing Invalid Memory Access by allowing users to interact directly with JNI
Although this is not necessary, we recommend that libraries in other languages provide corresponding Java class bindings to provide a similar programming experience to Java
The currently available library is Mliybs.Minecraft.Fabric for C# NativeAOT
Load your code
Assuming you have made a dll, you need to create a valid resource package in the nativepacks folder of the game directory (if it doesn't exist, the game will automatically create it when it starts running), and place your dll in the assets/arbitrary namespace ID/natives/ directory, for example:

It is important to note that the path and file name must be valid identifiers and can only contain lowercase letters, numbers, and ,.-_ characters
Once done, launch the game and the game will automatically load all dll/so/dylib in the natives path in all namespaces(the resource pack will also be loaded)
If your dll contains code to modify the game, you should be able to see the changes in the game
If your dll is coming from someone else, make sure it's safe
P.S
NativeLoader is currently in the development phase, but the basic functionality is complete
We expect that Mixin is unlikely to add support in the future, but reflection in Java is not limited to this (called directly via JNI functions)
NativeLoader needs more people to help improve it, contributions are welcome!
简体中文
NativeLoader是一个兼容层Fabric Mod,旨在通过除Java Kotlin以外的能编译成原生代码的其他语言修改游戏内容。它通过JNI和JNA与原生代码交互,不仅给了原生代码足够的灵活程度还尽可能减少了性能开销。
使用
NativeLoader本身只负责调用本机的原生代码以及提供包装类,并不会修改游戏内容,你需要使用其他能够编译成原生代码的语言并将它们发布成dll/so/dylib才能真正修改游戏
在编写代码的时候往往需要使用第三方库,这能够避免让用户直接与JNI交互导致Invalid Memory Access
尽管这不是必要的,但我们建议其他语言的库提供相对应的Java类绑定,尽力提供与Java相似的编程体验
目前的可用库有 Mliybs.Minecraft.Fabric,用于C# NativeAOT
调用你的代码
假设你已经制作好了一个dll,你需要在游戏目录下的nativepacks文件夹(若不存在则游戏在开始运行时会自动创建)中创建一个合法的资源包(这个资源包后续也会用来存放资源),在assets/任意命名空间ID/natives/目录中放置你的dll,例如:

需要注意的是,路径和文件名必须是合法的标识符,只能包含小写字母,数字,以及,.-_几个字符
完成后,启动游戏,游戏就会自动加载所有命名空间中natives路径下的所有dll/so/dylib(资源包也会被强制加载)
如果你的dll中包含了修改游戏的代码,你应该就能在游戏中看到它的更改了
如果你的dll来自其他人,请确保它是安全的
附言
NativeLoader目前还处于开发阶段,但基本功能已完成
我们预计将来Mixin不太可能添加支持,但Java中的反射不受此限制(直接通过JNI函数进行调用)
NativeLoader需要更多人来帮助完善,欢迎所有人的贡献!
Project description from Modrinth.
Pick your setup
NativeLoader by Minecraft version and loader
Choose the version and loader you play, then open the matching release.
1.20.5
1 loader build1.20.4
1 loader buildCheck the dependencies, then try the file in a copied instance before changing a world you care about.
Recent files
NativeLoader versions and loaders
0.7.4
native-loader-0.7.4.jar
25 Jan 2025
0.7.3
native-loader-0.7.3.jar
24 Jan 2025
Looking for an older file? The official Modrinth project page is in Resources.