Skip to content

Commit 7b89d58

Browse files
authored
Merge pull request #173 from hypherionmc/lts/1.4
Fix modern versions of NeoForge failing to complete setup
2 parents 08eda9b + 8e64092 commit 7b89d58

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ dependencies {
126126
implementation(libs.binarypatcher) {
127127
exclude(mapOf("group" to "commons-io"))
128128
}
129+
130+
implementation(libs.neo.binarypatcher) {
131+
exclude(mapOf("group" to "commons-io"))
132+
}
129133
implementation(libs.jbsdiff)
130134

131135
implementation(libs.classtweaker)

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ tiny-remapper = "0.11.1"
1414
unimined-mapping-library = "1.2.1"
1515

1616
binarypatcher = "1.1.1"
17+
neo_binarypatcher = "4.0.7"
1718
jbsdiff = "1.0"
1819

1920
commons-io = "2.20.0"
@@ -45,6 +46,7 @@ tiny-remapper = { module = "net.fabricmc:tiny-remapper", version.ref = "tiny-rem
4546
unimined-mapping-library-jvm = { module = "xyz.wagyourtail.unimined.mapping:unimined-mapping-library-jvm", version.ref = "unimined-mapping-library" }
4647

4748
binarypatcher = { module = "net.minecraftforge:binarypatcher", version.ref = "binarypatcher" }
49+
neo_binarypatcher = { module = "net.neoforged.installertools:binarypatcher", version.ref = "neo_binarypatcher" }
4850
jbsdiff = { module = "io.sigpipe:jbsdiff", version.ref = "jbsdiff" }
4951

5052
classtweaker = { module = "net.fabricmc:class-tweaker", version.ref = "classtweaker" }

src/minecraft/kotlin/xyz/wagyourtail/unimined/internal/minecraft/patch/forge/fg3/FG3MinecraftTransformer.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,22 +531,29 @@ open class FG3MinecraftTransformer(project: Project, val parent: ForgeLikeMinecr
531531

532532
if (!patchedMC.path.exists() || project.unimined.forceReload) {
533533
patchedMC.path.deleteIfExists()
534+
val additionalArgs = listOf("--data", "--unpatched")
535+
val isModernNeo = (provider.minecraftData.mcVersionCompare("1.21.9", provider.version) == -1 && parent.providerName.equals("NeoForged", true))
536+
534537
val args = (userdevCfg["binpatcher"].asJsonObject["args"].asJsonArray.map {
535538
when (it.asString) {
536539
"{clean}" -> inputMC.path.toString()
537540
"{patch}" -> binPatchFile.toString()
538541
"{output}" -> patchedMC.path.toString()
539542
else -> it.asString
540543
}
541-
} + listOf("--data", "--unpatched")).toTypedArray()
544+
} + if (isModernNeo) listOf() else additionalArgs).toTypedArray()
542545
val stoutLevel = project.gradle.startParameter.logLevel
543546
val stdout = System.out
544547
if (stoutLevel > LogLevel.INFO) {
545548
System.setOut(PrintStream(NullOutputStream.INSTANCE))
546549
}
547550
project.logger.info("Running binpatcher with args: ${args.joinToString(" ")}")
548551
try {
549-
ConsoleTool.main(args)
552+
if (isModernNeo) {
553+
net.neoforged.binarypatcher.ConsoleTool.main(args)
554+
} else {
555+
ConsoleTool.main(args)
556+
}
550557
} catch (e: Throwable) {
551558
e.printStackTrace()
552559
patchedMC.path.deleteIfExists()

0 commit comments

Comments
 (0)