Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

Refactor restart logic. Auto restart is disabled by default now because of
plenty of mod incompatibility.

## 0.4.0

Updated to 26.1.2. No new features yet.
5 changes: 5 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
`java-library`
kotlin("jvm") version "2.3.21"
}

group = "io.github.zly2006"
version = rootProject.version

Expand Down
108 changes: 51 additions & 57 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
plugins {
`maven-publish`
id("fabric-loom")
kotlin("jvm")
kotlin("plugin.serialization")
id("io.github.goooler.shadow") version "8.1.7"
id("me.modmuss50.mod-publish-plugin")
id("net.fabricmc.fabric-loom") version "1.16-SNAPSHOT"
kotlin("jvm") version "2.3.21"
kotlin("plugin.serialization") version "2.3.21"
id("com.gradleup.shadow") version "9.0.0"
id("me.modmuss50.mod-publish-plugin") version "0.5.1"
}

import org.gradle.api.tasks.bundling.AbstractArchiveTask

class ModData {
val id = property("mod.id").toString()
val name = property("mod.name").toString()
Expand All @@ -20,9 +22,12 @@ class ModDependencies {

val mod = ModData()
val deps = ModDependencies()
val mcVersion = stonecutter.current.version
val mcVersion = "26.1.2"
val mcDep = property("mod.mc_dep").toString()

// MC 26.1.2 is unobfuscated — no remapping needed, use shadowJar directly
val jarTaskProvider = tasks.named<AbstractArchiveTask>("shadowJar")

version = "${mod.version}+$mcVersion"
group = mod.group
base { archivesName.set(mod.id) }
Expand All @@ -31,6 +36,19 @@ loom {
accessWidenerPath = rootProject.file("src/main/resources/xb.shared.accesswidener")
}

allprojects {
repositories {
mavenCentral()
}
configurations.all {
resolutionStrategy {
force("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
force("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.10.2")
force("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.10.2")
}
}
}

repositories {
fun strictMaven(url: String, alias: String, vararg groups: String) = exclusiveContent {
forRepository { maven(url) { name = alias } }
Expand All @@ -43,46 +61,42 @@ repositories {
}

dependencies {
println("CONFIGS: " + configurations.map { it.name })
fun fapi(vararg modules: String) = modules.forEach {
modImplementation(fabricApi.module(it, deps["fabric_api"]))
implementation(fabricApi.module(it, deps["fabric_api"]))
}

testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.6.10")

minecraft("com.mojang:minecraft:$mcVersion")
mappings("net.fabricmc:yarn:$mcVersion+build.${deps["yarn_build"]}:v2")
modImplementation("net.fabricmc:fabric-loader:${deps["fabric_loader"]}")
modImplementation("net.fabricmc:fabric-language-kotlin:${deps["kotlin_loader_version"]}")
// MC 26.1.2 is unobfuscated — no Yarn mappings needed
implementation("net.fabricmc:fabric-loader:${deps["fabric_loader"]}")
implementation("net.fabricmc:fabric-language-kotlin:${deps["kotlin_loader_version"]}")
fapi(
// Add modules from https://github.com/FabricMC/fabric
"fabric-lifecycle-events-v1",
"fabric-resource-loader-v0"
"fabric-resource-loader-v0",
"fabric-command-api-v2"
)

if (stonecutter.eval(stonecutter.current.version, ">=1.20")) {
fapi("fabric-command-api-v2")
}

if (deps["poly_lib"].isNotEmpty()) {
modCompileOnly("net.creeperhost:polylib-fabric:${deps["poly_lib"]}") {
compileOnly("maven.modrinth:polylib:2.0.6") {
exclude(group = "net.fabricmc.fabric-api")
exclude(group = "dev.architectury")
exclude(group = "teamreborn")
}
}

api(project(":common"))
configurations.create("compileLib") {
defaultDependencies {
add(project(":common", configuration = "shadow"))
}
}
configurations.create("compileLib")
add("compileLib", project(":common"))
add("compileLib", project(":api"))
add("compileLib", project(":common", configuration = "shadow"))
compileOnly(project(":compat-fake-source"))
}

loom {
decompilers {
get("vineflower").apply { // Adds names to lambdas - useful for mixins
get("vineflower").apply {
options.put("mark-corresponding-synthetics", "1")
}
}
Expand All @@ -94,9 +108,8 @@ loom {
}
}

val javaVersion =
if (stonecutter.eval(mcVersion, ">=1.20.6")) 21
else 17
// MC 26.1.2 requires Java 25
val javaVersion = 25

java {
withSourcesJar()
Expand Down Expand Up @@ -126,7 +139,6 @@ tasks.processResources {
dependsOn(project(":common").tasks.processResources)
outputs.upToDateWhen { false }
doLast {
// copying this is for dev only, int here is a shadowJar task
copy {
from(project(":common").tasks.processResources.get().outputs.files)
into(outputs.files.first())
Expand All @@ -136,7 +148,7 @@ tasks.processResources {

tasks.register<Copy>("buildAndCollect") {
group = "build"
from(tasks.remapJar.get().archiveFile)
from(jarTaskProvider.flatMap { it.archiveFile })
into(rootProject.layout.buildDirectory.file("libs/${mod.version}"))
dependsOn("build")
}
Expand All @@ -149,7 +161,7 @@ tasks {
project.configurations.shadow.get(),
project.configurations["compileLib"]
)
archiveClassifier.set("dev-all")
archiveClassifier.set("")

exclude("kotlin/**", "kotlinx/**", "javax/**")
exclude("org/checkerframework/**", "org/intellij/**", "org/jetbrains/annotations/**")
Expand Down Expand Up @@ -179,48 +191,30 @@ tasks {
relocate(it, relocatePath + it)
}
}

remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.get().archiveFile)
}
}


publishMods {
file = tasks.remapJar.get().archiveFile
file = jarTaskProvider.flatMap { it.archiveFile }
displayName = "${mod.name} ${mod.version} for $mcVersion"
version = "${mod.version}+$mcVersion"
changelog = rootProject.file("CHANGELOG.md").readText()
type = STABLE
modLoaders.add("fabric")

// dryRun = providers.environmentVariable("MODRINTH_TOKEN")
// .getOrNull() == null || providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() == null

modrinth {
projectId = property("publish.modrinth").toString()
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.addAll(
property("mod.mc_targets").toString().split(" ")
.filter { it.isNotBlank() }
.plus(mcVersion)
.distinct()
)
minecraftVersions.add(mcVersion)
requires("fabric-api", "fabric-language-kotlin")
optional("polylib")
}
}

// curseforge {
// projectId = property("publish.curseforge").toString()
// accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
// minecraftVersions.addAll(
// property("mod.mc_targets").toString().split(" ")
// .filter { it.isNotBlank() }
// .plus(mcVersion)
// .distinct()
// )
// requires("fabric-api", "fabric-language-kotlin")
// optional("polylib")
// }
tasks.jar {
enabled = false
}

tasks.assemble {
dependsOn(tasks.shadowJar)
}

15 changes: 3 additions & 12 deletions cli/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import java.util.jar.Attributes

plugins {
id("io.github.goooler.shadow") version "8.1.7"
java
kotlin("jvm") version "2.3.21"
id("com.gradleup.shadow") version "9.0.0"
}

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("com.guardsquare:proguard-gradle:7.6.0")
}
}

apply(plugin = "java")

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
13 changes: 8 additions & 5 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@file:Suppress("PropertyName")

plugins {
id("io.github.goooler.shadow") version "8.1.7"
`java-library`
kotlin("jvm") version "2.3.21"
kotlin("plugin.serialization") version "2.3.21"
id("com.gradleup.shadow") version "9.0.0"
}

val exposed_version = property("deps.exposed_version") as String
Expand Down Expand Up @@ -37,10 +40,10 @@ dependencies {
sharedLib("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktorVersion")
sharedLib(project(":api"))
// kotlin
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
api("org.jetbrains.kotlinx:atomicfu:0.26.0")
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.3.21")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
api("org.jetbrains.kotlinx:atomicfu:0.27.0")
}

tasks {
Expand Down
7 changes: 6 additions & 1 deletion common/src/main/resources/assets/x-backup/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
"command.xb.statistics": "Total backups: %s, Blob disk usage: %s, Actual disk usage (only count valid backups): %s",
"command.xb.status": "X Backup status: %s",
"command.xb.uploading_backup": "Uploading backup %s...",
"command.xb.version": "X Backup %s https://github.com/zly2006/x-backup",
"command.xb.version": "X Backup %s by lnminh https://github.com/lnminh1411/x-backup",
"command.xb.config_reloaded": "Configuration reloaded",
"command.xb.exporting_backup": "Exporting backup %s...",
"command.xb.backup_exported": "Backup %s exported successfully",
"command.xb.zipping_backup": "Zipping backup %s...",
"command.xb.backup_zipped": "Backup %s zipped successfully",
"message.xb.error.free_plan_limit": "You have reached the free plan limit (1 GB per backup, 3 backups in total), please upgrade to premium plan at https://redenmc.com/x-backup/plans",
"message.xb.prune_finished": "Prune finished, %s backups pruned",
"message.xb.pruning_backup": "Pruning backup %s",
Expand Down
7 changes: 6 additions & 1 deletion common/src/main/resources/assets/x-backup/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
"command.xb.statistics": "总备份数: %s, 总磁盘使用量: %s, 实际磁盘使用量 (仅计算有效备份): %s",
"command.xb.status": "X Backup 状态: %s",
"command.xb.uploading_backup": "正在上传备份 %s...",
"command.xb.version": "X Backup %s https://github.com/zly2006/x-backup",
"command.xb.version": "X Backup %s by lnminh https://github.com/lnminh1411/x-backup",
"command.xb.config_reloaded": "配置已重新加载",
"command.xb.exporting_backup": "正在导出备份 %s...",
"command.xb.backup_exported": "备份 %s 导出成功",
"command.xb.zipping_backup": "正在打包备份 %s...",
"command.xb.backup_zipped": "备份 %s 打包成功",
"message.xb.error.free_plan_limit": "你已达到免费限额 (每个备份最多1GB, 总共 3 个备份),请升级到高级计划 https://redenmc.com/x-backup/plans",
"message.xb.prune_finished": "清理完成,已删除 %s 个备份",
"message.xb.pruning_backup": "正在清理旧备份 %s",
Expand Down
9 changes: 9 additions & 0 deletions compat-fake-source/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
java
kotlin("jvm") version "2.3.21"
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -10,3 +15,7 @@ tasks.withType<JavaCompile>().configureEach {
kotlin {
jvmToolchain(17)
}

tasks.jar {
exclude("net/minecraft/**")
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package me.lucko.fabric.api.permissions.v0;

import net.minecraft.command.CommandSource;
import net.minecraft.commands.SharedSuggestionProvider;
import org.jetbrains.annotations.NotNull;

@SuppressWarnings("unused")
public interface Permissions {
static boolean check(@NotNull CommandSource source, @NotNull String permission, boolean defaultValue) {
static boolean check(@NotNull SharedSuggestionProvider source, @NotNull String permission, boolean defaultValue) {
throw new AssertionError("Stub!");
}

static boolean check(@NotNull CommandSource source, @NotNull String permission, int defaultRequiredLevel) {
static boolean check(@NotNull SharedSuggestionProvider source, @NotNull String permission, int defaultRequiredLevel) {
throw new AssertionError("Stub!");
}

static boolean check(@NotNull CommandSource source, @NotNull String permission) {
static boolean check(@NotNull SharedSuggestionProvider source, @NotNull String permission) {
throw new AssertionError("Stub!");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.minecraft.command;
package net.minecraft.commands;

public interface CommandSource {
boolean hasPermissionLevel(int level);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package net.minecraft.commands;

public interface SharedSuggestionProvider {
}
Loading
Loading