From 1b6a1f0fb7ac37a4ac7c90ece91856c311f98545 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Wed, 4 Dec 2024 18:47:18 +0100 Subject: [PATCH] Backport to forge-1.20 --- implementations/forge/build.gradle.kts | 15 +++++++++++---- .../bluemap/forge/ForgeCommandSource.java | 2 +- .../de/bluecolored/bluemap/forge/ForgeWorld.java | 2 +- settings.gradle.kts | 12 ++++++------ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/implementations/forge/build.gradle.kts b/implementations/forge/build.gradle.kts index 2aa25706e..7adc98577 100644 --- a/implementations/forge/build.gradle.kts +++ b/implementations/forge/build.gradle.kts @@ -6,11 +6,11 @@ plugins { } val supportedMinecraftVersions = listOf( - "1.21", "1.21.1", "1.21.2", "1.21.3" + "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4" ) val minecraftVersion = supportedMinecraftVersions.first() -val forgeVersion = "51.0.1" +val forgeVersion = "46.0.1" val shadowInclude: Configuration by configurations.creating configurations.api.get().extendsFrom(shadowInclude) @@ -31,7 +31,7 @@ dependencies { minecraft { mappings( "official", minecraftVersion ) - reobf = false + reobf = true } tasks.shadowJar { @@ -97,8 +97,15 @@ val mergeShadowAndJarJar = tasks.create("mergeShadowAndJarJar") { archiveFileName = "${project.name}-${project.version}-merged.jar" } +reobf { + create("mergeShadowAndJarJar") { + mappings = tasks.createMcpToSrg.map { it.output.get() } + } +} + +val reobfMergeShadowAndJarJar = tasks.getByName("reobfMergeShadowAndJarJar") tasks.getByName("release") { - dependsOn( mergeShadowAndJarJar ) + dependsOn( reobfMergeShadowAndJarJar ) inputFile = mergeShadowAndJarJar.outputs.files.singleFile } diff --git a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java index 6c4cce314..64428e6f7 100644 --- a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java +++ b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java @@ -49,7 +49,7 @@ public ForgeCommandSource(ForgeMod mod, Plugin plugin, CommandSourceStack delega @Override public void sendMessage(Text text) { - var component = Component.Serializer.fromJsonLenient(text.toJSONString(), delegate.registryAccess()); + var component = Component.Serializer.fromJsonLenient(text.toJSONString()); if (component != null) delegate.sendSuccess(() -> component, false); } diff --git a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java index 404f5e915..dc2284be2 100644 --- a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java +++ b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java @@ -48,7 +48,7 @@ public ForgeWorld(ServerLevel delegate) { this.delegate = new WeakReference<>(delegate); MinecraftServer server = delegate.getServer(); - this.worldFolder = delegate.getServer().getServerDirectory() + this.worldFolder = delegate.getServer().getServerDirectory().toPath() .resolve(server.getWorldPath(LevelResource.ROOT)); ResourceLocation id = delegate.dimension().location(); diff --git a/settings.gradle.kts b/settings.gradle.kts index cd2481e72..c8f337eb0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,13 +22,13 @@ includeBuild("api") include(":core") include(":common") -implementation("cli") -implementation("fabric") +//implementation("cli") +//implementation("fabric") implementation("forge") -implementation("neoforge") -implementation("paper") -implementation("spigot") -implementation("sponge") +//implementation("neoforge") +//implementation("paper") +//implementation("spigot") +//implementation("sponge") fun implementation(name: String) { val project = ":$name"