voxels: migrate to canonical structure
- Commit
2c124429d998f8e9d593aea861abd5d26b140cc5- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-15 19:50 UTC (3 months ago)
- Parents
6198b6d
Diff
games/voxels/src/main/AndroidManifest.xml
diff --git a/games/voxels/src/main/AndroidManifest.xml b/games/voxels/src/main/AndroidManifest.xmlindex be0427d829..f604c5722f 100644--- a/games/voxels/src/main/AndroidManifest.xml+++ b/games/voxels/src/main/AndroidManifest.xml@@ -8,7 +8,7 @@ <application android:allowBackup="true"- android:backupAgent=".util.AppBackupAgent"+ android:backupAgent=".platform.AppBackupAgent" android:dataExtractionRules="@xml/data_extraction_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"@@ -17,7 +17,7 @@ android:theme="@style/Theme.General"> <activity android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"- android:name=".MenuActivity"+ android:name=".platform.MenuActivity" android:screenOrientation="sensorLandscape" android:exported="true" android:launchMode="singleTop"
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 5e9485463f..a0b89f0aad 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@@ -20,9 +20,9 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import com.vayunmathur.games.voxels.ui.*-import com.vayunmathur.games.voxels.util.VoxelsAchievements+import com.vayunmathur.games.voxels.platform.VoxelsAchievements import com.vayunmathur.games.voxels.util.VoxelsNative-import com.vayunmathur.games.voxels.util.VoxelsSync+import com.vayunmathur.games.voxels.network.VoxelsSync import com.vayunmathur.e2ee.Pqc import com.vayunmathur.library.ui.* import com.vayunmathur.library.util.GameHubComposeHook@@ -59,8 +59,8 @@ class MainActivity : ComponentActivity() { // Put the engine in host/client mode before the render thread starts ticking. if (online) try { VoxelsNative.nativeSetRole(netRole) } catch (_: Exception) {} }- com.vayunmathur.games.voxels.util.SoundFx.init(this)- com.vayunmathur.games.voxels.util.MusicFx.startAmbient(this)+ com.vayunmathur.games.voxels.platform.SoundFx.init(this)+ com.vayunmathur.games.voxels.platform.MusicFx.startAmbient(this) setContent { VoxelsTheme { var inventoryJson by remember { mutableStateOf("""{"selected":0,"slots":[{"id":3,"count":64},{"id":2,"count":64},{"id":1,"count":64},{"id":4,"count":16},{"id":10,"count":32},{"id":6,"count":32},{"id":7,"count":16},{"id":8,"count":16},{"id":9,"count":16}]}""") }@@ -113,14 +113,14 @@ class MainActivity : ComponentActivity() { val amb = org.json.JSONObject(VoxelsNative.getAmbienceJson()) val stepN = amb.optInt("stepN", prevStep) if (prevStep >= 0 && stepN != prevStep) {- com.vayunmathur.games.voxels.util.SoundFx.playStep(amb.optInt("stepMat", 0))+ com.vayunmathur.games.voxels.platform.SoundFx.playStep(amb.optInt("stepMat", 0)) } prevStep = stepN val cueN = amb.optInt("cueN", prevCue) if (prevCue >= 0 && cueN != prevCue) { when (amb.optInt("cueKind", 0)) {- 1 -> com.vayunmathur.games.voxels.util.SoundFx.playCave()- 2 -> com.vayunmathur.games.voxels.util.SoundFx.playStalk()+ 1 -> com.vayunmathur.games.voxels.platform.SoundFx.playCave()+ 2 -> com.vayunmathur.games.voxels.platform.SoundFx.playStalk() } } prevCue = cueN@@ -138,8 +138,8 @@ class MainActivity : ComponentActivity() { healthJson = VoxelsNative.getHealthJson() val hp = org.json.JSONObject(healthJson).optDouble("hp", prevHp.toDouble()).toFloat() if (hp < prevHp - 0.5f) {- if (prevHp - hp > 6f) com.vayunmathur.games.voxels.util.SoundFx.playExplode()- else com.vayunmathur.games.voxels.util.SoundFx.playHurt()+ if (prevHp - hp > 6f) com.vayunmathur.games.voxels.platform.SoundFx.playExplode()+ else com.vayunmathur.games.voxels.platform.SoundFx.playHurt() } prevHp = hp } catch (_: Exception) {}@@ -332,7 +332,7 @@ class MainActivity : ComponentActivity() { onPlace = { off -> try { val code = VoxelsNative.placeBlockAt(off.x, off.y) when (code) {- 1 -> com.vayunmathur.games.voxels.util.SoundFx.playPlace()+ 1 -> com.vayunmathur.games.voxels.platform.SoundFx.playPlace() 11 -> { invStartTab = 2; inventoryOpen = true } // crafting table 12, 14 -> { // furnace / blast furnace furnaceIsBlast = code == 14@@ -342,7 +342,7 @@ class MainActivity : ComponentActivity() { 13 -> { // jukebox: play the held disc (or stop) val inv = try { com.vayunmathur.games.voxels.ui.voxelsJson.decodeFromString<com.vayunmathur.games.voxels.ui.InventoryState>(inventoryJson) } catch (_: Exception) { null } val held = inv?.slots?.getOrNull(inv.selected)?.id ?: 0- com.vayunmathur.games.voxels.util.MusicFx.toggle(this@MainActivity, com.vayunmathur.games.voxels.ui.discTrack[held])+ com.vayunmathur.games.voxels.platform.MusicFx.toggle(this@MainActivity, com.vayunmathur.games.voxels.ui.discTrack[held]) } 15 -> stonecutterOpen = true // stonecutter // Every villager has its own profession and level, so the stall is@@ -356,12 +356,12 @@ class MainActivity : ComponentActivity() { chestOpen = true // Online clients mirror host state: ask for the real contents. if (online) try { VoxelsNative.netRequestContainer() } catch (_: Exception) {}- com.vayunmathur.games.voxels.util.SoundFx.playPlace()+ com.vayunmathur.games.voxels.platform.SoundFx.playPlace() }- 41 -> com.vayunmathur.games.voxels.util.SoundFx.playPlace() // ignited a portal+ 41 -> com.vayunmathur.games.voxels.platform.SoundFx.playPlace() // ignited a portal } } catch (_: Exception) {} },- onBreak = { off -> try { if (VoxelsNative.breakBlockAt(off.x, off.y)) com.vayunmathur.games.voxels.util.SoundFx.playBreak() } catch (_: Exception) {} }+ onBreak = { off -> try { if (VoxelsNative.breakBlockAt(off.x, off.y)) com.vayunmathur.games.voxels.platform.SoundFx.playBreak() } catch (_: Exception) {} } ) } @@ -522,7 +522,7 @@ class MainActivity : ComponentActivity() { } override fun onDestroy() {- com.vayunmathur.games.voxels.util.MusicFx.stop()+ com.vayunmathur.games.voxels.platform.MusicFx.stop() VoxelsSync.stopLive() if (VoxelsNative.isAvailable) { try { VoxelsNative.nativeSetRole(0) } catch (_: Exception) {}
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 1c59281e28..e890b1b902 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@@ -1,4 +1,4 @@-package com.vayunmathur.games.voxels.util+package com.vayunmathur.games.voxels.data import android.content.Context import kotlinx.coroutines.CoroutineScope@@ -6,6 +6,8 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json+import com.vayunmathur.games.voxels.network.VoxelsRoles+import com.vayunmathur.games.voxels.platform.VoxelsAchievementsManager import java.io.File import kotlin.random.Random
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 0036651043..125fdb253c 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@@ -1,6 +1,6 @@ @file:OptIn(kotlin.uuid.ExperimentalUuidApi::class) -package com.vayunmathur.games.voxels.util+package com.vayunmathur.games.voxels.network import kotlin.uuid.Uuid import android.content.Context
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 17a6fb8231..1b2b270907 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@@ -1,4 +1,4 @@-package com.vayunmathur.games.voxels.util+package com.vayunmathur.games.voxels.platform import com.vayunmathur.library.util.BaseBackupAgent
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 b0c1f16453..2aaf11c777 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@@ -1,6 +1,6 @@ @file:OptIn(kotlin.io.encoding.ExperimentalEncodingApi::class) -package com.vayunmathur.games.voxels+package com.vayunmathur.games.voxels.platform import android.content.ClipData import android.content.ClipboardManager@@ -26,10 +26,10 @@ import com.vayunmathur.games.voxels.ui.WorldCreatorScreen import com.vayunmathur.library.ui.DynamicTheme import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.util.rememberIsOnline-import com.vayunmathur.games.voxels.util.VoxelsRoles-import com.vayunmathur.games.voxels.util.VoxelsSync-import com.vayunmathur.games.voxels.util.WorldInfo-import com.vayunmathur.games.voxels.util.WorldManager+import com.vayunmathur.games.voxels.network.VoxelsRoles+import com.vayunmathur.games.voxels.network.VoxelsSync+import com.vayunmathur.games.voxels.data.WorldInfo+import com.vayunmathur.games.voxels.data.WorldManager import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext
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 2cb9c847f9..9477cfaa8d 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@@ -1,4 +1,4 @@-package com.vayunmathur.games.voxels.util+package com.vayunmathur.games.voxels.platform import android.content.Context import android.content.res.AssetManager
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 f39bdac9e7..c1eea8fbfe 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@@ -1,4 +1,4 @@-package com.vayunmathur.games.voxels.util+package com.vayunmathur.games.voxels.platform import android.content.Context import android.media.SoundPool
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 b2d4fe4526..7d5de070f8 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@@ -1,4 +1,4 @@-package com.vayunmathur.games.voxels.util+package com.vayunmathur.games.voxels.platform import android.content.Context import com.vayunmathur.library.util.AchievementsManager
games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/MenuScreens.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/MenuScreens.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/MenuScreens.ktindex acefed33c3..cf839a89cd 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/MenuScreens.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/MenuScreens.kt@@ -29,9 +29,9 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog-import com.vayunmathur.games.voxels.util.WorldInfo-import com.vayunmathur.games.voxels.util.VoxelsRoles-import com.vayunmathur.games.voxels.util.VoxelsSync+import com.vayunmathur.games.voxels.data.WorldInfo+import com.vayunmathur.games.voxels.network.VoxelsRoles+import com.vayunmathur.games.voxels.network.VoxelsSync import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.Button