- TitleScreenMixin : TransferState null sur startConnecting -> connexion normale, corrige "This server does not accept transfers". - PauseScreenMixin (nouveau) : renomme le bouton de deconnexion du menu Echap en "Quitter SurviePote" et redirige vers l'ecran d'accueil (TitleScreen) au lieu de la liste des serveurs. - build.gradle : tache runClient (dev sans loom) reutilisant ~/.surviepote/common. - Jar 1.1.3 copie dans l'atlas + distribution.json regenere.
161 lines
6.9 KiB
Groovy
161 lines
6.9 KiB
Groovy
// SurviePote - nosingleplayer : build SANS loom.
|
|
// MC 26.3 n'est plus obfusqué (noms Mojang lisibles dans le jar vanilla) et Mojang ne
|
|
// publie plus de mappings (pas de client_mappings/server_mappings, pas de Yarn 26.x).
|
|
// On compile directement contre le jar client Mojang + loader/mixin en compileOnly.
|
|
plugins {
|
|
id 'java'
|
|
}
|
|
|
|
version = project.mod_version
|
|
group = project.maven_group
|
|
|
|
base {
|
|
archivesName = project.archives_base_name
|
|
}
|
|
|
|
def mcDir = layout.buildDirectory.dir('mc')
|
|
|
|
tasks.register('downloadMcLibs') {
|
|
def manifestUrl = 'https://piston-meta.mojang.com/mc/game/version_manifest_v2.json'
|
|
def mcVersion = project.minecraft_version
|
|
def loaderVersion = project.loader_version
|
|
outputs.dir(mcDir)
|
|
doLast {
|
|
def outDir = mcDir.get().asFile
|
|
outDir.mkdirs()
|
|
def dl = { String url, File dest ->
|
|
if (!dest.exists()) {
|
|
println "Téléchargement ${dest.name} ..."
|
|
new URL(url).withInputStream { i -> dest.withOutputStream { it << i } }
|
|
}
|
|
}
|
|
def manifest = new groovy.json.JsonSlurper().parse(new URL(manifestUrl))
|
|
def entry = manifest.versions.find { it.id == mcVersion }
|
|
if (entry == null) throw new GradleException("Version MC introuvable : ${mcVersion}")
|
|
def versionJson = new groovy.json.JsonSlurper().parse(new URL(entry.url))
|
|
dl(versionJson.downloads.client.url, new File(outDir, 'client.jar'))
|
|
dl("https://maven.fabricmc.net/net/fabricmc/fabric-loader/${loaderVersion}/fabric-loader-${loaderVersion}.jar",
|
|
new File(outDir, 'fabric-loader.jar'))
|
|
dl('https://maven.fabricmc.net/net/fabricmc/sponge-mixin/0.17.5+mixin.0.8.7/sponge-mixin-0.17.5+mixin.0.8.7.jar',
|
|
new File(outDir, 'sponge-mixin.jar'))
|
|
dl('https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar',
|
|
new File(outDir, 'slf4j-api.jar'))
|
|
dl('https://libraries.minecraft.net/com/mojang/brigadier/1.3.11/brigadier-1.3.11.jar',
|
|
new File(outDir, 'brigadier.jar'))
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly files({ tasks.named('downloadMcLibs').map { mcDir.get().asFile.listFiles().findAll { it.name.endsWith('.jar') } } })
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.release = 25
|
|
it.dependsOn('downloadMcLibs')
|
|
}
|
|
|
|
processResources {
|
|
inputs.property 'version', project.version
|
|
filesMatching('fabric.mod.json') {
|
|
expand 'version': project.version
|
|
}
|
|
}
|
|
|
|
java {
|
|
withSourcesJar()
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Dev : lance le vrai client MC 26.3 + nosingleplayer (build sans loom).
|
|
// Réutilise l'installation commune du launcher SurviePote (~/.surviepote/common :
|
|
// versions, libraries, assets — remplie au premier lancement). Le mod est copié
|
|
// dans runClient/game/mods/ (Knot le découvre comme un mod Fabric classique).
|
|
// Usage : ./gradlew runClient
|
|
// ---------------------------------------------------------------------------
|
|
def survieCommon = new File(System.getProperty('user.home'), '.surviepote/common')
|
|
def mcVersion = project.minecraft_version
|
|
def loaderVersion = project.loader_version
|
|
|
|
tasks.register('extractClientNatives', Copy) {
|
|
def versionJson = new groovy.json.JsonSlurper().parse(
|
|
new File(survieCommon, "versions/${mcVersion}/${mcVersion}.json"))
|
|
from(versionJson.libraries.findAll { lib ->
|
|
lib.name.contains(':natives-linux') && (lib.rules == null || lib.rules.any { it.action == 'allow' && (it.os == null || it.os.name == 'linux') })
|
|
}.collect { lib ->
|
|
zipTree(new File(survieCommon, "libraries/${lib.downloads.artifact.path}"))
|
|
})
|
|
into(layout.buildDirectory.dir('runClient/natives'))
|
|
include('**/*.so')
|
|
eachFile { f -> f.path = f.name }
|
|
}
|
|
|
|
tasks.register('runClient', JavaExec) {
|
|
dependsOn('extractClientNatives', 'jar')
|
|
group = 'fabric'
|
|
description = 'Lance le client Minecraft avec le mod (dev visuel, sans loom).'
|
|
|
|
def versionJson = new groovy.json.JsonSlurper().parse(
|
|
new File(survieCommon, "versions/${mcVersion}/${mcVersion}.json"))
|
|
def fabricJson = new groovy.json.JsonSlurper().parse(
|
|
new File(survieCommon, "versions/${mcVersion}-fabric-${loaderVersion}/${mcVersion}-fabric-${loaderVersion}.json"))
|
|
def mavenToPath = { String coord ->
|
|
def parts = coord.split(':')
|
|
return "${parts[0].replace('.', '/')}/${parts[1]}/${parts[2]}/${parts[1]}-${parts[2]}.jar"
|
|
}
|
|
|
|
doFirst {
|
|
def modsDir = layout.buildDirectory.dir('runClient/game/mods').get().asFile
|
|
delete(modsDir)
|
|
modsDir.mkdirs()
|
|
copy {
|
|
from(tasks.named('jar'))
|
|
into(modsDir)
|
|
}
|
|
}
|
|
|
|
// NixOS : dlopen ne voit ni libGL ni libvulkan sans LD_LIBRARY_PATH (cf launcher).
|
|
def nixStore = new File('/nix/store')
|
|
def glDirs = []
|
|
['/run/opengl-driver/lib', '/run/current-system/sw/lib'].each { d ->
|
|
if (new File(d).exists()) glDirs << d
|
|
}
|
|
if (nixStore.exists()) {
|
|
nixStore.eachDir { e ->
|
|
def n = e.name
|
|
if (n.contains('libglvnd') || n.contains('vulkan-loader') || n.contains('alsa-lib')
|
|
|| n.contains('pulseaudio') || (n.contains('pipewire') && !n.contains('python'))) {
|
|
def lib = new File(e, 'lib')
|
|
if (lib.exists()) glDirs << lib.absolutePath
|
|
}
|
|
}
|
|
}
|
|
def prevLd = System.getenv('LD_LIBRARY_PATH')
|
|
environment('LD_LIBRARY_PATH', (prevLd ? prevLd + ':' : '') + glDirs.join(':'))
|
|
if (!System.getenv('SDL_VIDEODRIVER') && (System.getenv('WAYLAND_DISPLAY') || new File('/run/user/1000/wayland-1').exists())) {
|
|
environment('SDL_VIDEODRIVER', 'wayland')
|
|
}
|
|
|
|
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(25) }
|
|
classpath = files(
|
|
new File(survieCommon, "versions/${mcVersion}/${mcVersion}.jar"),
|
|
versionJson.libraries.findAll { lib ->
|
|
!(lib.name.contains(':natives-')) && (lib.rules == null || lib.rules.any { it.action == 'allow' && (it.os == null || it.os.name == 'linux') })
|
|
}.collect { new File(survieCommon, "libraries/${it.downloads.artifact.path}") },
|
|
fabricJson.libraries.collect { new File(survieCommon, "libraries/${mavenToPath(it.name)}") }
|
|
)
|
|
mainClass = 'net.fabricmc.loader.impl.launch.knot.KnotClient'
|
|
args = [
|
|
'--gameDir', layout.buildDirectory.dir('runClient/game').get().asFile.absolutePath,
|
|
'--assetsDir', new File(survieCommon, 'assets').absolutePath,
|
|
'--assetIndex', versionJson.assetIndex.id,
|
|
'--version', "${project.archives_base_name}-dev",
|
|
'--username', 'Dev', '--uuid', '00000000-0000-0000-0000-000000000000',
|
|
'--accessToken', '0', '--versionType', 'release'
|
|
]
|
|
jvmArgs = [
|
|
"-Djava.library.path=${layout.buildDirectory.dir('runClient/natives').get().asFile.absolutePath}",
|
|
'-Xmx4G'
|
|
]
|
|
systemProperties['org.lwjgl.util.Debug'] = 'false'
|
|
}
|