Modern Apps git

← Modern-Apps.git

games/voxels: document public API for detekt

Commit
194b9f8d7f4b0cf00bc05e403ef4cd784322e096
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:42 UTC (19 days ago)
Parents
103c05d
Add concise KDoc to every public class, object, interface and
enum (including nested types) that detekt's
UndocumentedPublicClass rule flagged in this module. Docs only:
no behaviour, visibility or config changes.

Verified: ./gradlew :games:voxels:detekt reports 0
UndocumentedPublicClass findings (pre-existing error-severity
findings in other rules, where present, are untouched), and the
module unit tests pass.
Unit tests pass with the pre-existing, unrelated
library:map/games:voxels rustFileLength failure excluded
(Rust file length in untouched Rust sources).

Diff

games/voxels/src/main/java/com/vayunmathur/games/voxels/MainActivity.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/MainActivity.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/MainActivity.ktindex 0a60d89f25..f1325ccb28 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/MainActivity.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/MainActivity.kt@@ -105,6 +105,7 @@ import kotlin.math.PI private const val ACTION_PLACE = 0 private const val ACTION_ACT = 1 +/** Game activity for Voxels; owns the engine session, pause state, and in-game HUD. */ class MainActivity : ComponentActivity() {     // Pause-menu state lives on the activity so onStop can pause the game: coming back from Home or     // the lock screen lands on the pause menu instead of straight into whatever was attacking.
games/voxels/src/main/java/com/vayunmathur/games/voxels/data/WorldManager.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/data/WorldManager.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/data/WorldManager.ktindex 171829dac9..ca38f79863 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/data/WorldManager.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/data/WorldManager.kt@@ -13,6 +13,7 @@ import kotlin.random.Random  // On-disk metadata for a single world, stored as `world.json` inside the world's directory. // The `online` fields are absent on legacy single-player saves (defaults keep them loading).+/** On-disk metadata for one world, stored as `world.json` in its save directory. */ @Serializable data class WorldMeta(     val name: String,@@ -39,12 +40,14 @@ object WorldMode { }  // A world plus its resolved id (directory name) and absolute save path. Not persisted directly.+/** A world with its resolved id (directory name) and absolute save path. */ data class WorldInfo(     val id: String,     val dir: String,     val meta: WorldMeta, ) +/** Creates, lists, and resolves saved Voxels worlds on disk. */ object WorldManager {     private val json = Json { ignoreUnknownKeys = true; prettyPrint = true } 
games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.ktindex c82e4337c1..d08b53ce27 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt@@ -376,14 +376,18 @@ object VoxelsSync {     /** An owner-signed member record (only records with a valid owner signature are honored). */     @Serializable data class SignedMember(val member: Member, val sig: String) +    /** Pending world invites plus the relay cursor they were read at. */     class InvitesResult(val invites: List<Invite>, val seq: Int)+    /** Inbox contents — invites and join requests — plus the relay cursor. */     class InboxResult(val invites: List<Invite>, val requests: List<JoinRequest>, val seq: Int)+    /** Pulled world operations plus the relay cursor. */     class OpsResult(val items: List<String>, val seq: Int)      @Serializable private data class SubMsg(val t: String, val channel: String)     @Serializable private data class PresenceMsg(val t: String, val channel: String, val data: String)     @Serializable private data class AppendMsg(val t: String, val channel: String, val actions: List<String>) +    /** Ephemeral live-relay message carrying presence or channel actions; never persisted. */     @Serializable data class LiveMsg(         val t: String = "",         val channel: String = "",
games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/AppBackupAgent.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/AppBackupAgent.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/AppBackupAgent.ktindex 3df1054065..be35433949 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/AppBackupAgent.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/AppBackupAgent.kt@@ -2,6 +2,7 @@ package com.vayunmathur.games.voxels.platform  import com.vayunmathur.library.util.BaseBackupAgent +/** Cloud backup rules for Voxels preferences; saved worlds stay out of the payload. */ class AppBackupAgent : BaseBackupAgent() {     override val prefNames: List<String> get() = listOf("voxels_prefs") 
games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MenuActivity.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MenuActivity.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MenuActivity.ktindex 91e63e355d..f365586aec 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MenuActivity.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MenuActivity.kt@@ -50,6 +50,7 @@ import kotlin.random.Random // Launcher screen: lists saved worlds and hosts the world creator. Playing a world starts // MainActivity (the game) with the world's save directory + seed passed as intent extras. Online // worlds add the shared world id + AES key + role so the game can start VoxelsSync in host/client mode.+/** Launcher menu for Voxels: lists saved worlds and hosts world creation and join links. */ class MenuActivity : ComponentActivity() {     // Bumped on each onResume so the world list reloads when returning from the game     // (keeps last-played ordering fresh).
games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MusicFx.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MusicFx.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MusicFx.ktindex bab47d4830..e5fd4ad01d 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MusicFx.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/MusicFx.kt@@ -15,6 +15,7 @@ import com.vayunmathur.games.voxels.domain.musicVolumeScale // foreground and holds audio focus: it pauses on Home, the lock screen and calls, and resumes when // the game comes back. Best-effort; never throws into the UI. // MediaPlayer/AudioManager signal failure with assorted runtime exceptions; all are swallowed here.+/** Background music for Voxels: ambient playlist and jukebox discs under audio-focus control. */ @Suppress("TooGenericExceptionCaught", "TooManyFunctions") object MusicFx {     private const val AMBIENT_VOLUME = 0.45f
games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/SoundFx.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/SoundFx.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/SoundFx.ktindex 4f30baca15..59c84bf089 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/SoundFx.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/SoundFx.kt@@ -13,6 +13,7 @@ import kotlin.random.Random  // Lightweight procedural SFX: synthesizes short break/place blips into cached WAVs and plays them via // SoundPool. No audio assets required. All calls are best-effort (never throw into the UI).+/** Procedural sound effects for Voxels, synthesised locally and played via SoundPool. */ object SoundFx {     private const val SR = 22050     private var pool: SoundPool? = null
games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsAchievementsManager.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsAchievementsManager.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsAchievementsManager.ktindex 7d5de070f8..739143160f 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsAchievementsManager.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsAchievementsManager.kt@@ -21,6 +21,7 @@ class VoxelsAchievementsManager(     override fun checkExistingAchievements() {} } +/** Two-tier Voxels achievements: per-world progress forwarded to the app-wide Games Hub tier. */ class VoxelsAchievements(context: Context, json: String, worldId: String) {     /** The tier the Games Hub sees. Unprefixed, and shared by every world. */     val app = VoxelsAchievementsManager(context, json)
games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsNative.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsNative.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsNative.ktindex e5637df10a..7e8cdbf34d 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsNative.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/platform/VoxelsNative.kt@@ -8,6 +8,7 @@ import android.view.Surface  // JNI bridge: one extern fun per native entry point (count is inherent to the // engine surface), and loadLibrary must catch Throwable (UnsatisfiedLinkError).+/** JNI bridge to the Rust Voxels engine (`voxels_engine`). */ @Suppress("TooManyFunctions", "TooGenericExceptionCaught") object VoxelsNative {     val isAvailable: Boolean = try {
games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/FurnaceScreen.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/FurnaceScreen.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/FurnaceScreen.ktindex 1715069f8d..a2a313e127 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/FurnaceScreen.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/FurnaceScreen.kt@@ -41,11 +41,13 @@ import com.vayunmathur.games.voxels.util.VoxelsNative import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.library.ui.Text +/** One furnace recipe: inputs, output, smelt time, and whether it needs a blast furnace. */ data class SmeltRecipe(     val inId: Int, val inN: Int, val in2Id: Int, val in2N: Int,     val outId: Int, val outN: Int, val secs: Float, val blast: Boolean ) +/** Live furnace state: active recipe, progress, and remaining fuel. */ data class SmeltState(val active: Boolean, val recipe: Int, val progress: Float, val fuel: Float)  fun parseSmeltRecipes(json: String): List<SmeltRecipe> = try {
games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.ktindex 6750c30d00..d2ad66a294 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt@@ -32,9 +32,11 @@ import kotlinx.serialization.json.Json  internal val voxelsJson = Json { ignoreUnknownKeys = true } +/** One inventory slot: item id and stack count (durability for tools and armour). */ @Serializable data class InvSlot(val id: Int, val count: Int) +/** Player inventory snapshot from the engine: selected slot, hotbar slots, and armour. */ @Serializable data class InventoryState(val selected: Int = 0, val slots: List<InvSlot> = List(9) { InvSlot(0, 0) }, val armor: List<InvSlot> = emptyList()) 
games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/VoxelSurfaceView.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/VoxelSurfaceView.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/VoxelSurfaceView.ktindex 2815982393..6fd6433894 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/VoxelSurfaceView.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/VoxelSurfaceView.kt@@ -7,6 +7,7 @@ import android.view.SurfaceView import com.vayunmathur.games.voxels.util.VoxelsNative import com.vayunmathur.library.log.Log +/** SurfaceView that forwards its surface lifecycle to the Rust engine. */ class VoxelSurfaceView @JvmOverloads constructor(     context: Context,     attrs: AttributeSet? = null