Skip to content

Building

the-real-ltcg edited this page Jul 9, 2026 · 1 revision

Building

Requires JDK 25.

git clone https://github.com/the-real-ltcg/key-holder.git
cd key-holder
./gradlew build

The jar is output to fabric-26.2/build/libs/key-holder-fabric-26.2-<version>.jar.

Project layout

  • common/ — shared platform-agnostic logic (config load/save, hold/toggle state machine). Zero Minecraft dependency, so it stays easy to reuse if another loader is added later. Not a Gradle module; compiled directly into the Fabric jar.
  • fabric/ — Fabric entrypoint, commands, keybind, Mod Menu config screen, and fabric.mod.json template. Not a Gradle module.
  • fabric-26.2/ — the actual buildable Gradle module. Just a build.gradle pointing its source sets at common/ and fabric/, plus the MC 26.2 dependency coordinates from the root gradle.properties.

This mirrors the layout used by afk-chat-spammer, just with only one loader/version wired up for now — adding a second Minecraft version or loader later means adding one more build.gradle module pointing at the same shared source, not duplicating source.

Notes on the Minecraft 26.2 API

This project uses official Mojang mappings directly (Loom's non-remapping mode for 26.x — Yarn mappings aren't published for 26.2 yet), so class/method names in the source are Mojang's own, not Yarn's. A couple of things that changed recently and are easy to trip over if you're used to older MC versions or Yarn naming:

  • ResourceLocation was renamed to Identifier (net.minecraft.resources.Identifier).
  • Fabric API renamed KeyBindingHelper to KeyMappingHelper (net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper).

Key holding itself is done via the vanilla static KeyMapping.set(InputConstants.Key, boolean), called every client tick while enabled — the same method vanilla uses internally when a real key press comes in from GLFW.

When in doubt about a class's real API on this Minecraft version, extract the deobfuscated jar from ~/.gradle/caches/fabric-loom/minecraftMaven/... and run javap -p against it rather than guessing from docs, which may be stale for a Minecraft version this new.

Clone this wiki locally