Skip to content

Commit

Permalink
Merge pull request #1 from ENDERZOMBI102/main
Browse files Browse the repository at this point in the history
fix: Update to unimined 1.3.9
  • Loading branch information
wagyourtail authored Nov 1, 2024
2 parents e4b46b1 + c1e864a commit f872eec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {

runtimeOnly(gradleApi())

implementation("xyz.wagyourtail.unimined:unimined:1.1.0-SNAPSHOT")
implementation("xyz.wagyourtail.unimined:unimined:1.3.9")
"installerImplementation"("io.github.java-diff-utils:java-diff-utils:4.12")
"installerImplementation"("io.github.prcraftmc:class-diff:1.0-SNAPSHOT")
"installerImplementation"("org.jetbrains:annotations:24.0.1")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Nov 21 10:56:45 MST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package xyz.wagyourtail.patchbase.gradle

import org.gradle.api.Project
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
import xyz.wagyourtail.patchbase.installer.PatchbaseInstaller
import xyz.wagyourtail.unimined.api.minecraft.MinecraftConfig
import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar
import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider
import xyz.wagyourtail.unimined.internal.minecraft.patch.MinecraftJar
import xyz.wagyourtail.unimined.internal.minecraft.patch.jarmod.JarModAgentMinecraftTransformer
import xyz.wagyourtail.unimined.internal.minecraft.patch.jarmod.JarModMinecraftTransformer
import xyz.wagyourtail.unimined.util.withSourceSet


fun MinecraftConfig.patchBase(action: PatchBaseMinecraftTransformer.() -> Unit = {}) {
customPatcher(PatchBaseMinecraftTransformer(this.project, this as MinecraftProvider), action)
}
Expand All @@ -18,14 +19,17 @@ class PatchBaseMinecraftTransformer(project: Project, provider: MinecraftProvide

override fun transform(minecraft: MinecraftJar): MinecraftJar {
val patchDep = patchBase.dependencies.last()
val patchJar = patchBase.files(patchDep).first { it.extension == "jar" || it.extension == "zip" }
val outputFolder = minecraft.path.parent.resolve(patchDep.name).resolve(patchDep.version)

val patchedMC = MinecraftJar(
minecraft,
parentPath = outputFolder,
patches = minecraft.patches + "patchbase"
)
val patchJar = patchBase
.incoming
.artifactView { view -> view.componentFilter { it is ModuleComponentIdentifier && it.group == patchDep.group && it.version == patchDep.version && it.module == patchDep.name } }
.files
.first { it.extension == "jar" || it.extension == "zip" }
val outputFolder = minecraft.path
.parent
.resolve(patchDep.name)
.resolve(patchDep.version!!)

val patchedMC = MinecraftJar(minecraft, outputFolder, patches = minecraft.patches + "patchbase")

PatchbaseInstaller().patch(patchJar.toPath(), minecraft.path, patchedMC.path)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import xyz.wagyourtail.unimined.util.withSourceSet
abstract class PatchExtension(val project: Project) {

fun patchBaseCreator(sourceSet: SourceSet) {
val mc = project.unimined.minecrafts.map[sourceSet]!!
val mc = project.unimined.minecrafts[sourceSet]!!
if (mc.side == EnvType.COMBINED) {
project.logger.warn("[PatchBase/Creator ${this.project.path} ${sourceSet}] Merged may make applying patches more difficult, proceed with caution")
}
Expand Down Expand Up @@ -70,5 +70,4 @@ abstract class PatchExtension(val project: Project) {
fun patchBase(minecraftConfig: MinecraftConfig) {
minecraftConfig.patchBase()
}

}

0 comments on commit f872eec

Please sign in to comment.