Skip to content

Building

the-real-ltcg edited this page Jul 4, 2026 · 3 revisions

Building

Requires JDK 25.

git clone https://github.com/the-real-ltcg/afk-chat-spammer.git
cd afk-chat-spammer
./gradlew build

This builds all six platform/version combinations:

  • fabric-26.2/build/libs/afk-chat-spammer-fabric-26.2-<version>.jar
  • fabric-26.1/build/libs/afk-chat-spammer-fabric-26.1-<version>.jar
  • neoforge-26.2/build/libs/afk-chat-spammer-neoforge-26.2-<version>.jar
  • neoforge-26.1/build/libs/afk-chat-spammer-neoforge-26.1-<version>.jar
  • forge-26.2/build/libs/afk-chat-spammer-forge-26.2-<version>.jar
  • forge-26.1/build/libs/afk-chat-spammer-forge-26.1-<version>.jar

Build just one with, e.g., ./gradlew :fabric-26.2:build or ./gradlew :forge-26.1:build.

Project layout

  • common/ — shared platform-agnostic logic (config, spam timer). Not a Gradle module; its sources are compiled directly into every platform jar.
  • fabric/ — shared Fabric source + fabric.mod.json template, identical across both MC versions. Not a Gradle module.
  • neoforge/ — shared NeoForge source + neoforge.mods.toml template, identical across both MC versions. Not a Gradle module.
  • forge/ — shared Forge source + mods.toml template, identical across both MC versions except one spot where MC 26.2 renamed Minecraft.setScreen to setScreenAndShow (26.1.2 has both, so the shared code uses that name). Includes its own minimal vanilla-widget config screen, since Cloth Config dropped Forge support in late 2024. Not a Gradle module.
  • fabric-26.2/, fabric-26.1/, neoforge-26.2/, neoforge-26.1/, forge-26.2/, forge-26.1/ — the actual buildable Gradle modules. Each is just a build.gradle pointing its source sets at the shared folders above, with that version's dependency coordinates. Adding a new Minecraft version means adding one more small build.gradle per loader — no source duplication needed, since the API surface used by this mod barely changes between 26.1.2 and 26.2 (one rename, see above).

Forge toolchain notes

Forge uses a different, newer build plugin than Fabric/NeoForge: net.minecraftforge.gradle version [7.0.17,8) (ForgeGradle 7), paired with the new record-based EventBus 7 API. This is a different event style than NeoForge's: instead of a shared NeoForge.EVENT_BUS.addListener(Class, handler), each event class now exposes its own static BUS field, e.g. TickEvent.ClientTickEvent.Post.BUS.addListener(handler) or RegisterClientCommandsEvent.BUS.addListener(handler). Mod entry points also changed shape: @Mod classes take a FMLJavaModLoadingContext constructor parameter, and context.getContainer().registerExtensionPoint(...) replaces the deprecated ModLoadingContext.get().

Adding a Minecraft version

  1. Add a mcXXX_* block of dependency coordinates to the root gradle.properties (Minecraft version, Fabric API version, NeoForge version, Forge version, Cloth Config version, Mod Menu version — check each directly rather than trusting a search summary: Modrinth's API for Fabric/NeoForge/Cloth Config/Mod Menu, e.g. api.modrinth.com/v2/project/fabric-api/version?game_versions=["26.x"]; Forge's own files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json for the Forge build number).
  2. Copy fabric-26.2/build.gradle, neoforge-26.2/build.gradle, and forge-26.2/build.gradle into new fabric-XX.X/, neoforge-XX.X/, and forge-XX.X/ folders, swapping the property prefix.
  3. Add all three to settings.gradle.
  4. Build and fix whatever actually breaks — don't assume API parity. Between 26.1.2 and 26.2 alone, one vanilla method (Minecraft.setScreen) was already renamed; verify anything uncertain by extracting the real dependency jar and running javap against it, rather than guessing from docs or examples that may be stale.

Clone this wiki locally