
NilKit API
NilKit API provides reusable utilities for mods built around NilLoader, with a particular focus on legacy Minecraft development.
- Загрузки
- 319
- Подписчики
- 2
- Обновлён
- 6 августа 2026 г.
- Лицензия
- LGPL-3.0-or-later
Опубликован 21 марта 2026 г.
NilKit API
An independent utility API and developer toolkit for mods built with NilLoader.
Important
NilKit is not part of the official NilLoader project and is not required to use NilLoader.
NilLoader is maintained separately at:
https://git.sleeping.town/Nil/NilLoader
NilKit provides reusable APIs and tooling for legacy Minecraft mod development, with a focus on reducing boilerplate around events, reflection, mappings, metadata, networking, and development utilities.
NilKit 4.1.0 targets Java 8 bytecode and does not require a hard runtime link to a specific Minecraft JAR for its core APIs. Minecraft-specific functionality remains dependent on the mappings and structure of the target game version.
Features
Events and lifecycle
- Lightweight event bus
- Cancellable events
- Listener priorities
premain/hijacklifecycle helpers- Typed and annotation-based listeners
Reflection and legacy Minecraft tooling
- Reflection helpers for version-dependent Minecraft code
- SRG/CSRG mapping utilities
- Mapping inspection, reversal, chaining, and lookup
- Integration with the external
MinecraftRemappingmapping repository during development
KDL
NilKit includes a general-purpose KDL parser and writer and can use KDL for richer project/mod metadata.
KDL support is optional. NilKit does not require NilLoader mods to use KDL, and standard NilLoader metadata remains fully supported.
Example:
nilmod {
name "My Mod"
description "Example mod"
authors "Author"
version "1.0.0"
}
entrypoints {
premain "com.example.MyPremain"
hijack "com.example.MyHijack"
}
nilkit {
requires "nilloader" "nilkit"
load_after "nilkit"
icon "assets/mymod/icon.png"
modurl "https://modrinth.com/mod/my-mod"
sourceurl "https://github.com/example/my-mod"
license "MIT"
credits "Author"
}
Networking
- Java NIO client/server utilities
- Packet registry and codecs
- Optional Minecraft-facing network helpers
Developer toolbox
The optional -all.jar also bundles several developer libraries without relocating their public packages:
- Byte Buddy
- GEB
- ClassGraph
- SnakeYAML
The normal NilKit artifact does not require these libraries at runtime.
Gradle
repositories {
maven {
url = uri("https://repo.tamkungz.me")
}
}
dependencies {
implementation "me.tamkungz.nilkit:nilkit:4.1.0"
}
Documentation
Full documentation and development information are available in the GitHub repository:
https://github.com/NilKitAPI/NilKit-API/tree/main/docs
NilLoader
NilKit is designed to complement NilLoader, not replace it.
NilLoader itself, its loading lifecycle, and its upstream development remain separate from NilKit.
License
NilKit is licensed under LGPL-3.0-or-later.
Ченджлог
4.1.0Релиз26.1, 26.1.1, 26.1.2 · 6 августа 2026 г.
[4.1.0] - 2026-08-06
Byte Buddy patching framework
- Expanded the Byte Buddy integration from a thin helper wrapper into a reusable patching framework designed for Mixin-style runtime transformations.
- Added
ByteBuddyPatchas a declarative patch definition API for targeting classes and applying multiple transformations without manually recreatingAgentBuilderor transformer boilerplate. - Added
ByteBuddyPatchRegistryfor managing multiple patches with deterministic ordering and configurable priorities. - Added JVM descriptor-based method matching for more reliable targeting across mapped, obfuscated, and legacy Minecraft environments.
- Added patch validation through
require(...), allowing transformations to fail immediately when an expected method or target is missing instead of silently continuing with an unapplied patch. - Added reusable Advice-based injection support for method entry, method exit, constructors, argument modification, return-value modification, and exception handling.
- Added support for replacing complete method implementations through direct Byte Buddy interception.
- Added low-level transformation access through
mutate(...), allowing patches to use raw Byte Buddy features such asMemberSubstitution, ASM visitors, field/method definitions, implemented interfaces, and custom builder mutations. - Kept the underlying Byte Buddy API exposed so advanced transformations are not restricted by the higher-level NilKit abstraction.
Runtime transformation
- Added a NilLoader transformation bridge so registered Byte Buddy patches can participate directly in NilLoader class transformation without requiring Byte Buddy self-attachment.
- Added optional
Instrumentation-based installation with retransformation support for environments where already-loaded classes must be patched. - Preserved explicit Byte Buddy Agent attachment behavior; NilKit still does not automatically invoke
ByteBuddyAgent.install()during SDK startup. - Added composition support so multiple independent patches can safely target the same class through a single transformation pipeline.
- Improved transformation diagnostics and failure behavior for incompatible targets, incorrect mappings, and changed method descriptors.
Documentation
- Added documentation and examples for using the Byte Buddy patch API as a Mixin-style transformation layer.
- Documented patch registration, priorities, required targets, Advice injection, full method interception, and advanced raw Byte Buddy mutations.
- Added examples showing integration through the NilLoader transformer bridge without requiring a Java agent.
4.0.0Релиз26.1, 26.1.1, 26.1.2 · 6 августа 2026 г.
Refactor Project
3.0.2Релиз26.1, 26.1.1, 26.1.2 · 6 августа 2026 г.
[3.0.2] - 2026-08-06
Developer toolbox
- Added the optional
[SDK]-3.0.2-all.jardeveloper toolbox with Byte Buddy1.17.6, Byte Buddy Agent1.17.6, GEB core0.5.4, ClassGraph4.8.184, and SnakeYAML2.6, keeping upstream package names unrelocated for direct imports. - Added
DeveloperToolboxcapability checks plusByteBuddyHelper,ClassGraphHelper,YamlHelper, andGebHelperconvenience APIs. - Byte Buddy self-attachment remains explicit; SDK startup never calls
ByteBuddyAgent.install()automatically. - YAML helpers use
SafeConstructor, reject duplicate mapping keys, and cap aliases for safer configuration loading. - Moved GEB's
processorto the GradleannotationProcessorconfiguration. It is build-time tooling and is not bundled in the runtime shadow JAR. - Optional toolbox dependencies are available to SDK compilation/tests but are not published as transitive dependencies of the normal Maven artifact.
Build and publishing
- Ensured
assemble/buildcreates the-all.jarand standalone-mapping-tool.jaralongside the normal JAR. - Attached both classified JARs to the Maven publication so project-local GPG publishing signs them together with sources/Javadocs.
- Moved signing configuration after classified artifact attachment and added project license/implementation metadata to the standalone mapping-tool JAR.
- Simplified the Windows Gradle launcher to respect the active
JAVA_HOMEselected byactions/setup-javabefore scanning other installed JDKs, while still rejecting unsupported Java 25 for Gradle 8.8. - Preserved service-provider metadata in the shadow JAR and added third-party notices/license files to the distribution.
- Restored GitHub Actions
build.ymlfor Ubuntu/Windows on JDK 17/21 andrelease.ymlforv*tags, including tag/version validation, changelog extraction, SHA-256 checksums, and GitHub Release creation. - Restored release helper scripts and a submodule guard that detects a missing
160000Git link fortools/MinecraftRemapping.
Fixed and documented
- Replaced the accidental Gradle snippet previously stored in
THIRD_PARTY_LICENSES.mdwith an actual third-party license inventory. - Updated stale
3.0.1metadata and documentation references to the in-development3.0.2release. - Kept complete mapping data outside release artifacts; mapping input continues to come directly from
tools/MinecraftRemapping.
3.0.1Релиз1.12, 1.12.1, 1.12.2 · 5 августа 2026 г.
[3.0.1] - 2026-08-05
Compatibility
- Removed the SDK's hard bytecode link to
net.minecraft.client.Minecraft;McHelpernow resolves the mapped Minecraft class lazily through reflection only when Minecraft-specific helpers are called. - Removed the compile-time
game/jarmodMinecraft 1.4.7 dependencies from the SDK build. The core artifact no longer needs a Minecraft JAR to compile. - Removed unused external ASM 9.5 runtime dependencies; transformer helpers already use the loader's shaded ASM API, avoiding unnecessary ASM classpath conflicts in
-all.jar. MinecraftAutoNetworkBridgeno longer assumes Minecraft 1.4.7. When explicitly enabled it reads-D[sdk].minecraft.version=<version>and disables itself safely if the version or mappings are unavailable.- Added regression coverage that rejects hard
net.minecraft.*type references in the Minecraft-facing SDK classes.
Mapping workflow
- Removed the
.remappingstaging workflow.tools/MinecraftRemappingis now the single source path for mapping data. - Gradle mapping generation reads
tools/MinecraftRemapping/<version>/mcp2obf.srgdirectly from the pinned submodule. - Fixed
SimpleRemapso release JARs actually consume the generated mapping subset; 3.0.0 generatedGeneratedSrgMappingsbut never called it. - Replaced
prepareRemapping/import-submodulewith directinspectMinecraftRemapping,inspect-submodule, andsubmodule-pathworkflows. - Updated
gen_srg_mappings.pyto use project-relative paths instead of a machine-specific absolute Windows path.
Build fixes
- Removed duplicate declarations accidentally left in
build.gradle3.0.0 mapping-generation code.
3.0.0Релиз1.12, 1.12.1, 1.12.2 · 5 августа 2026 г.
[3.0.0] - 2026-08-05
Added
- Added
agaricusb/MinecraftRemappingas an external Git submodule configuration attools/MinecraftRemapping, pinned by the bootstrap scripts to8ca7ba25dfd67eae43b3c73d02603ff6c085a6d7. - Added a Java 8-compatible SRG/CSRG mapping API:
SrgMappingSetandSrgMappings. - Added
MappingToolMainwithinspect,reverse,chain,lookup,list-submodule, andimport-submodulecommands, plus a standalonemapping-toolJAR that contains no mapping data. - Added Gradle
mappingToolandprepareRemappingtasks for local mapping workflows. - Added
MAPPINGS.mddocumenting mapping-source policy and local-only import behavior. - Added cross-platform Gradle launcher JVM discovery for Linux/macOS and Windows. JDK 21 and 17 are preferred automatically so a system-wide Java 25 does not break Gradle 8.8.
- Added GitHub Actions
build.ymlfor push/pull-request builds and tests on Ubuntu/Windows with JDK 17/21. - Added GitHub Actions
release.ymlforv*tags. Releases are created only after build/tests succeed, include JARs plus SHA-256 checksums, and use the matchingCHANGE.mdsection as the release body. - Added release helper scripts that verify tag/project version consistency and extract one changelog section.
Changed
- Bumped the SDK and metadata version to
3.0.0. - Java compilation now targets Java 8 with
--release 8while Gradle itself runs on a supported modern launcher JDK; a dedicated local JDK 8 installation is no longer required for normal builds. - Complete mapping collections are no longer shipped in the project ZIP/release tree.
.remapping/remains gitignored and is treated as developer-supplied local build input. - GitHub release responsibilities were separated from normal commit CI:
build.ymlonly validates commits/PRs, whilerelease.ymlowns tagged releases.
Fixed
- Fixed Gradle 8.8 startup failing under Java 25 with
Unsupported class file major version 69by selecting a compatible installed launcher JDK before Gradle starts. - Fixed old mapping workflows relying on copied 100+ MB mapping trees by replacing them with explicit local import tooling and an external submodule reference.
- Mapping parsing now reports conflicting entries instead of silently replacing them, mapping composition keeps method descriptors namespace-correct, and CSRG member resolution no longer depends on class-entry order.
2.1.0Релиз1.7.8, 1.7.9, 1.7.10 · 5 августа 2026 г.
[2.1.0] - 2026-08-05
Added
- Added project-local Maven publishing to
./mavenviapublishProjectLocal; publications are OpenPGP-signed with the user's normal GnuPG /gpg-agentsetup. - Added inherited event-listener discovery, typed-listener unregistration, and event-bus clearing APIs.
- Added cooldown remaining-time queries and expired-player cleanup.
- Added NIO client/server state inspection (
isRunning,isConnected, connection snapshots/counts) and server bound-port lookup. - Added default listener hooks for unknown packet IDs and exhausted client reconnect attempts without breaking existing listener implementations.
- Added packet-registry inspection helpers (
isRegistered,size,clear). - Added lifecycle controls/state for the automatic Minecraft network bridge, including explicit
stop()and automatic recovery after reconnect exhaustion. - Added regression tests for KDL, cooldown concurrency, and packet codec/registry behavior.
Changed
- Normal
buildno longer forces loader decompilation;decompileLoaderremains an explicit developer task. - KDL scalar output now uses KDL 2 forms (
#true,#false,#null,#inf,#-inf,#nan). - KDL parsing now accepts common KDL 2 numeric forms, raw strings, quoted property keys, dotted identifiers, nested block comments, and slash-dash node/entry suppression while retaining legacy boolean/null compatibility.
- Event registration is de-duplicated, scans inherited subscriber methods, and preserves deterministic registration order for equal-priority handlers.
- Network listener callback failures are isolated from the selector loop; packet serialization failures no longer disconnect healthy peers.
- Network constructor and packet-registry inputs are validated early with clearer errors.
Fixed
- Fixed
TargetFinderreturning a nearby player that failed the requestedminDotaim threshold and fixed target ranking to prefer alignment with distance as the tie-breaker. - Fixed
CooldownTracker.tryUseGlobal/tryUsePlayerrace conditions so a cooldown window cannot be consumed concurrently by multiple callers. - Fixed entrypoint phase re-entrancy during the pre-dispatch event by installing the active-phase guard before posting the event.
- Fixed NIO server duplicate disconnect callbacks and stale connection entries.
- Fixed NIO client reconnect attempts terminating permanently when opening a replacement channel throws immediately or when a non-blocking connect completes immediately.
- Fixed KDL writer/parser round-trip failures for quoted property keys and KDL 2 scalar values.
- Fixed zero/invalid look-vector and negative-range edge cases in
TargetFinder. - Fixed
ReflectHelper.invokecontradicting its documented null-to-primitive-default behavior. - Fixed automatic network bridge getting stuck with a dead client after reconnect exhaustion.
- Fixed local SRG mapping reads using platform-default encoding and added clearer version validation.
2.0.1Релиз1.7.8, 1.7.9, 1.7.10 · 8 апреля 2026 г.
[2.0.1] - 2026-04-08
Added
- Added SDK runtime bootstrap for KDL-only mods (archives with
.sdkmod.kdlbut no root*.mod.css). - Added
KdlOnlyModBootstrapperto discover/inject such mods frommods/and[loader]mods/during SDK premain. - Added verbose bootstrap diagnostics for KDL-only loading flow (candidate scan, KDL entry detection, metadata parse status, classpath injection, premain invocation).
- Added formatted loaded-mod summary table log:
ID | Name | Version | Authors | License
Changed
- Bumped SDK version to
2.0.1in build and metadata resources. DefaultSdkEntrypointModulenow runs KDL-only bootstrap before dependency enforcement.
Fixed
- Fixed KDL parser newline/block handling in nested sections, resolving
KdlParseExceptionduring valid.sdkmod.kdlparsing. - Improved metadata text decoding for runtime reads (UTF-8/UTF-16 BOM and UTF-16 heuristic fallback) in bridge and SDK metadata IO.
- Fixed KDL-only metadata resolution so injected mods now correctly expose
name,version, andentrypointsinstead of fallback?values.
2.0.0Релиз1.7.8, 1.7.9, 1.7.10 · 8 апреля 2026 г.
[2.0.0] - 2026-04-08
Added
- Introduced KDL support as a first-class metadata layer in
2.0.0.- Prior to
2.0.0, mods relied on the loader's CSS metadata only (*.mod.css). 2.0.0adds SDK KDL metadata (*.sdkmod.kdl) and runtime bridge integration.
- Prior to
- Introduced a general-purpose KDL toolkit for broad SDK usage (not metadata-only):
KdlParser,KdlWriterKdlDocument,KdlNode,KdlValue,KdlParseException- Can be used by any system/module that needs KDL parsing/serialization.
LoaderHelperconvenience APIs for easier multi-mod integration and diagnostics:isAllModsLoaded(String...)getFirstLoadedMod(String...)getEntrypoints(String)hasEntrypoint(String, String)getModsWithEntrypoint(String)hasMissingRequiredMods(String)getMissingRequiredModsForLoadedMods()getModsRequiring(String)
- Forge/Fabric-like event architecture for easier mod development:
- Global SDK access point:
[SDK] - Event primitives:
Event,CancellableEvent,EventPriority,SubscribeEvent - Central
EventBuswith:- annotation listener registration (
@SubscribeEvent) - typed callback registration (
listenstyle) - cancellation-aware dispatch flow
- annotation listener registration (
- Lifecycle events:
PreEntrypointDispatchEvent(cancellable)PhaseEventPostEntrypointDispatchEvent
- Entrypoint dispatcher now emits lifecycle events around phase execution.
ModBasenow includes convenience methods to register/post/listen events.
- Global SDK access point:
- SDK KDL metadata schema expanded with richer mod info fields:
modurlsourceurllicensecredits(multi-value)
Changed
- Bumped SDK version to
2.0.0in build and metadata resources. MetadataBridgenow parses.sdkmod.kdlvia shared KDL parser (KdlParser) instead of manual string parsing for better compatibility.- KDL metadata merge now supports both section blocks (
mod {},entrypoints {}) and top-level fallback keys (name,description,authors,version,entrypoints.<phase>).
Fixed
- Removed inconsistent changelog carry-over for
1.0.4under2.0.0.
Notes
- New helper methods are Java 8 compatible and return immutable collections where applicable.
- Focus of this update is DX (developer experience): reduce repetitive loader metadata and dependency-check boilerplate in mods.
- Backward compatibility remains intact: CSS metadata stays primary, and KDL is additive for SDK-aware features.
Комментарии
Загружаем…