Skip to content

Commit

Permalink
Merge pull request #90 from halotroop2288/pr/nostalgia
Browse files Browse the repository at this point in the history
Wisp Forest Maven & Nostalgia Mappings
  • Loading branch information
wagyourtail authored Aug 6, 2024
2 parents 6d79ed0 + 9593230 commit 4783ec3
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ abstract class UniminedExtension(val project: Project) {
@Deprecated("Use glassLauncherMaven(\"babric\") instead", ReplaceWith("glassLauncherMaven(\"babric\")"))
abstract fun babricMaven()
abstract fun glassLauncherMaven(name: String)
abstract fun wispForestMaven(name: String = "releases")
abstract fun parchmentMaven()

abstract fun neoForgedMaven()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,38 @@ abstract class MappingsConfig<T: MappingResolver<T>>(val project: Project, val m
}
}

@JvmOverloads
fun nostalgia(
build: String,
key: String = "nostalgia",
@DelegatesTo(value = MappingEntry::class, strategy = Closure.DELEGATE_FIRST)
action: Closure<*>
) {
nostalgia(build.toInt(), key, action)
}

@JvmOverloads
abstract fun nostalgia(build: Int, key: String = "nostalgia", action: MappingEntry.() -> Unit = {})

@JvmOverloads
fun nostalgia(build: String, key: String = "nostalgia", action: MappingEntry.() -> Unit = {}) {
nostalgia(build.toInt(), key, action)
}

@JvmOverloads
fun nostalgia(
build: Int,
key: String = "nostalgia",
@DelegatesTo(value = MappingEntry::class, strategy = Closure.DELEGATE_FIRST)
action: Closure<*>
) {
nostalgia(build, key) {
action.delegate = this
action.resolveStrategy = Closure.DELEGATE_FIRST
action.call()
}
}


@JvmOverloads
abstract fun quilt(build: Int, key: String = "quilt", action: MappingEntry.() -> Unit = {})
Expand Down
11 changes: 11 additions & 0 deletions src/main/kotlin/xyz/wagyourtail/unimined/UniminedExtensionImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ open class UniminedExtensionImpl(project: Project) : UniminedExtension(project)
project.logger.info("[Unimined] adding Glass Launcher maven: ${glassLauncherMaven[name]}")
}

val wispForestMaven = defaultedMapOf<String, MavenArtifactRepository> { name ->
project.repositories.maven {
it.name = "Wisp Forest"
it.url = URI.create("https://maven.wispforest.io/$name")
}
}

override fun wispForestMaven(name: String) {
project.logger.info("[Unimined] adding Wisp Forest maven: ${wispForestMaven[name]}")
}

val wagYourMaven = defaultedMapOf<String, MavenArtifactRepository> { name ->
project.repositories.maven {
it.name = "WagYourTail (${name.capitalized()})"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,25 @@ class MappingsProvider(project: Project, minecraft: MinecraftConfig, subKey: Str
}
}


override fun nostalgia(build: Int, key: String, action: MappingEntry.() -> Unit) {
unimined.wispForestMaven()
val entry = MappingEntry(contentOf(
MavenCoords(
"me.alphamode",
"nostalgia",
"${minecraft.version}+build.$build",
)), "$key-$build"
).apply {
requires("babricIntermediary")
provides("nostalgia" to true)
action()
}
addDependency(key, entry)
afterLoad.add {
renest(entry.requires.name, *entry.provides.map { it.first.name }.toTypedArray())
}
}

override fun quilt(build: Int, key: String, action: MappingEntry.() -> Unit) {
unimined.quiltMaven()
val entry = MappingEntry(contentOf(
Expand Down

0 comments on commit 4783ec3

Please sign in to comment.