Translations and DBUS???? for some reason. also make the whole thing not buildable for anyone aside from me lol
This commit is contained in:
@@ -7,6 +7,8 @@ plugins {
|
|||||||
kotlin("plugin.serialization") version "1.7.10"
|
kotlin("plugin.serialization") version "1.7.10"
|
||||||
id("dev.architectury.loom") version "0.12.0.+"
|
id("dev.architectury.loom") version "0.12.0.+"
|
||||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||||
|
id("moe.nea.licenseextractificator") version "0.0.1"
|
||||||
|
id("com.github.eutro.hierarchical-lang") version "1.1.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
@@ -60,7 +62,10 @@ dependencies {
|
|||||||
// Actual dependencies
|
// Actual dependencies
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:${rootProject.property("rei_version")}")
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:${rootProject.property("rei_version")}")
|
||||||
shadowMe("io.github.moulberry:neurepoparser:0.0.1")
|
shadowMe("io.github.moulberry:neurepoparser:0.0.1")
|
||||||
|
shadowMe("com.github.hypfvieh:dbus-java-core:4.1.0")
|
||||||
|
shadowMe("com.github.hypfvieh:dbus-java-transport-native-unixsocket:4.1.0")
|
||||||
fun ktor(mod: String) = "io.ktor:ktor-$mod-jvm:${project.property("ktor_version")}"
|
fun ktor(mod: String) = "io.ktor:ktor-$mod-jvm:${project.property("ktor_version")}"
|
||||||
|
|
||||||
transInclude(implementation(ktor("client-core"))!!)
|
transInclude(implementation(ktor("client-core"))!!)
|
||||||
transInclude(implementation(ktor("client-java"))!!)
|
transInclude(implementation(ktor("client-java"))!!)
|
||||||
transInclude(implementation(ktor("serialization-kotlinx-json"))!!)
|
transInclude(implementation(ktor("serialization-kotlinx-json"))!!)
|
||||||
@@ -112,10 +117,21 @@ tasks.remapJar {
|
|||||||
dependsOn(tasks.shadowJar)
|
dependsOn(tasks.shadowJar)
|
||||||
archiveClassifier.set("thicc")
|
archiveClassifier.set("thicc")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
filesMatching("**/fabric.mod.json") {
|
filesMatching("**/fabric.mod.json") {
|
||||||
expand(
|
expand(
|
||||||
"version" to project.version
|
"version" to project.version
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
filesMatching("**/lang/*.json") {
|
||||||
|
flattenJson(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tasks.create<moe.nea.licenseextractificator.LicenseDiscoveryTask>("license") {
|
||||||
|
scanConfiguration(project.configurations.compileClasspath.get())
|
||||||
|
outputFile.set(file("$buildDir/LICENSES.json"))
|
||||||
|
licenseFormatter.set(moe.nea.licenseextractificator.JsonLicenseFormatter())
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
maven {
|
maven {
|
||||||
name = "fabricmc"
|
name = "fabricmc"
|
||||||
url = uri("https://maven.fabricmc.net/")
|
url = uri("https://maven.fabricmc.net/")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.ktor.client.plugins.contentnegotiation.*
|
|||||||
import io.ktor.serialization.kotlinx.json.*
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
import moe.nea.notenoughupdates.dbus.NEUDbusObject
|
||||||
import moe.nea.notenoughupdates.gui.repoGui
|
import moe.nea.notenoughupdates.gui.repoGui
|
||||||
import moe.nea.notenoughupdates.repo.RepoManager
|
import moe.nea.notenoughupdates.repo.RepoManager
|
||||||
import moe.nea.notenoughupdates.util.ConfigHolder
|
import moe.nea.notenoughupdates.util.ConfigHolder
|
||||||
@@ -25,6 +26,7 @@ import net.fabricmc.loader.api.metadata.ModMetadata
|
|||||||
import net.minecraft.commands.CommandBuildContext
|
import net.minecraft.commands.CommandBuildContext
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
|
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
@@ -57,6 +59,8 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val globalJob = Job()
|
val globalJob = Job()
|
||||||
|
val dbusConnection = DBusConnectionBuilder.forSessionBus()
|
||||||
|
.build()
|
||||||
val coroutineScope =
|
val coroutineScope =
|
||||||
CoroutineScope(EmptyCoroutineContext + CoroutineName("NotEnoughUpdates")) + SupervisorJob(globalJob)
|
CoroutineScope(EmptyCoroutineContext + CoroutineName("NotEnoughUpdates")) + SupervisorJob(globalJob)
|
||||||
val coroutineScopeIo = coroutineScope + Dispatchers.IO + SupervisorJob(globalJob)
|
val coroutineScopeIo = coroutineScope + Dispatchers.IO + SupervisorJob(globalJob)
|
||||||
@@ -73,7 +77,7 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
|
|||||||
Command.SINGLE_SUCCESS
|
Command.SINGLE_SUCCESS
|
||||||
})
|
})
|
||||||
.executes {
|
.executes {
|
||||||
it.source.sendFeedback(Component.literal("Reloading repository from disk. This may lag a bit."))
|
it.source.sendFeedback(Component.translatable("notenoughupdates.repo.reload.disk"))
|
||||||
RepoManager.reload()
|
RepoManager.reload()
|
||||||
Command.SINGLE_SUCCESS
|
Command.SINGLE_SUCCESS
|
||||||
})
|
})
|
||||||
@@ -87,6 +91,8 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onInitialize() {
|
override fun onInitialize() {
|
||||||
|
dbusConnection.requestBusName("moe.nea.notenoughupdates")
|
||||||
|
dbusConnection.exportObject(NEUDbusObject)
|
||||||
RepoManager.initialize()
|
RepoManager.initialize()
|
||||||
ConfigHolder.registerEvents()
|
ConfigHolder.registerEvents()
|
||||||
ClientCommandRegistrationCallback.EVENT.register(this::registerCommands)
|
ClientCommandRegistrationCallback.EVENT.register(this::registerCommands)
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package moe.nea.notenoughupdates.dbus
|
||||||
|
|
||||||
|
import org.freedesktop.dbus.annotations.DBusInterfaceName
|
||||||
|
import org.freedesktop.dbus.interfaces.DBusInterface
|
||||||
|
|
||||||
|
@DBusInterfaceName("moe.nea.NotEnoughUpdates")
|
||||||
|
interface NEUDbusInterface : DBusInterface {
|
||||||
|
fun sayHello(): String
|
||||||
|
fun getCurrentRepoCommit(): String
|
||||||
|
fun requestRepoReDownload()
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package moe.nea.notenoughupdates.dbus
|
||||||
|
|
||||||
|
import moe.nea.notenoughupdates.repo.RepoManager
|
||||||
|
|
||||||
|
object NEUDbusObject : NEUDbusInterface {
|
||||||
|
override fun sayHello(): String {
|
||||||
|
return "Hello from NEU"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getCurrentRepoCommit(): String {
|
||||||
|
return RepoManager.currentDownloadedSha ?: "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun requestRepoReDownload() {
|
||||||
|
RepoManager.launchAsyncUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getObjectPath(): String {
|
||||||
|
return "/moe/nea/NotEnoughUpdates"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,8 @@ object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Co
|
|||||||
var branch: String = "dangerous",
|
var branch: String = "dangerous",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val currentDownloadedSha by RepoDownloadManager::latestSavedVersionHash
|
||||||
|
|
||||||
var recentlyFailedToUpdateItemList = false
|
var recentlyFailedToUpdateItemList = false
|
||||||
|
|
||||||
val progressBar = ProgressBar("", null, 0).also {
|
val progressBar = ProgressBar("", null, 0).also {
|
||||||
@@ -72,6 +74,7 @@ object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Co
|
|||||||
Minecraft.getInstance().player?.sendSystemMessage(
|
Minecraft.getInstance().player?.sendSystemMessage(
|
||||||
Component.literal("Failed to reload repository. This will result in some mod features not working.")
|
Component.literal("Failed to reload repository. This will result in some mod features not working.")
|
||||||
)
|
)
|
||||||
|
CottonHud.remove(progressBar)
|
||||||
exc.printStackTrace()
|
exc.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"notenoughupdates": {
|
||||||
|
"repo": {
|
||||||
|
"reload": {
|
||||||
|
"disk": "Reloading repository from disk. This may lag a bit."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user