No description
Find a file
2026-07-12 16:31:53 +03:00
docs first commit 2026-07-12 16:31:53 +03:00
gradle/wrapper first commit 2026-07-12 16:31:53 +03:00
src/main first commit 2026-07-12 16:31:53 +03:00
.gitignore first commit 2026-07-12 16:31:53 +03:00
build.gradle first commit 2026-07-12 16:31:53 +03:00
gradle.properties first commit 2026-07-12 16:31:53 +03:00
gradlew first commit 2026-07-12 16:31:53 +03:00
gradlew.bat first commit 2026-07-12 16:31:53 +03:00
README.md first commit 2026-07-12 16:31:53 +03:00
settings.gradle first commit 2026-07-12 16:31:53 +03:00

AFK Cinematics — NeoForge 1.21.1 port

A client-side mod that starts cinematic camera shots when the player goes AFK. This is a functionally-identical port of the original Fabric 1.21.1 mod by spunkyinsaan to NeoForge 1.21.1.

  • Supports NeoForge [21.1.220,) — i.e. 21.1.220 up to 21.1.230+ and every later 21.1.x.
  • No Fabric API dependency (compile-time or runtime).
  • Pure client mod: works on a vanilla client and connects to any server (displayTest = IGNORE_ALL_VERSION).

Building

Requires JDK 21.

./gradlew build          # produces build/libs/afkcinematics-neoforge-1.21.1-1.21.1.jar
./gradlew runClient      # launches a dev client with the mod applied

The build compiles against NeoForge 21.1.230; the supported runtime range [21.1.220,) is declared independently in src/main/resources/META-INF/neoforge.mods.toml.

Commands (/afkc, client-side)

Command Behaviour Feedback
/afkc usage help `Usage: /afkc start
/afkc start force-start a cinematic now AFK Cinematics started
/afkc time show current timer Current AFK timer: <n> seconds
/afkc time <1..36000> set timer (seconds) and save AFK timer set to <n> seconds
/afkc music show music state `AFK cinematic music: on
/afkc music on / off toggle music and save `AFK cinematic music enabled
/afkc about mod/author info with clickable link AFK Cinematics - automatic cinematic AFK camera mod. Made by spunkyinsaan

Configuration

NeoForge TOML config at config/afkcinematics-client.toml (generated on first run), backed by ModConfigSpec. See docs/afkcinematics-client.toml.example.

Key Type Default Range
afk_timeout_seconds int 25 1 … 36000
cinematic_music_enabled bool true

/afkc time and /afkc music write straight back to this file.

How AFK is detected

Every client tick, the player is considered active if any of: a bound gameplay key is held, a GUI screen is open, the player position moved (distanceToSqr > 1e-4), or a raw keyboard/mouse input fired since the last tick. After afk_timeout_seconds (default 25s → 500 ticks) of inactivity the cinematic director starts; any activity stops it immediately.

Fabric → NeoForge mapping

Original (Fabric) This port (NeoForge)
ClientModInitializer entrypoint @Mod(dist = Dist.CLIENT) + game event bus
ClientTickEvents.END_CLIENT_TICK ClientTickEvent.Post
HudRenderCallback RenderGuiEvent.Post
ClientCommandRegistrationCallback RegisterClientCommandsEvent
afkcinematics.properties (hand-rolled) ModConfigSpec TOML config
Mixins (Yarn names) Same mixins, Mojang names (Camera#setup, KeyboardHandler#keyPress, MouseHandler#onMove/onPress/onScroll)

The camera itself is driven by a mixin at the TAIL of Camera#setup, exactly like the original — NeoForge exposes no event that can override camera position (only rotation via ViewportEvent.ComputeCameraAngles), so the mixin is the faithful equivalent.

Source layout

src/main/java/com/spunkyinsaan/afkcinematics/
├── AfkCinematics.java          # @Mod entry: registers config + client handler
├── AfkCinematicsClient.java    # tick loop, fade overlay, commands (NeoForge events)
├── AfkCinematicsConfig.java    # ModConfigSpec (TOML)
├── CinematicDirector.java      # shot selection + camera positioning (~110 presets)
├── CinematicCameraRig.java     # interpolated camera pose holder
├── InputActivityTracker.java   # cross-thread raw-input flag
└── mixin/
    ├── CameraMixin.java        # overrides camera pose while active
    ├── KeyboardMixin.java      # marks key activity
    └── MouseMixin.java         # marks mouse move/click/scroll activity