Skip to content

Commit

Permalink
fix mod loading in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Nov 5, 2024
1 parent bcff796 commit f407309
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 57 deletions.
18 changes: 10 additions & 8 deletions buildSrc/src/main/groovy/mod_conventions_common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,21 @@ repositories {
// maven { url = 'https://maven.ladysnake.org/releases' }
}

tasks.named('jar').configure {
inputs.files('LICENSE.md')
jar {
def licenseFile = rootProject.file('LICENSE.md')
inputs.files(licenseFile)

it.from(rootDir.toPath().resolve('LICENSE.md')) {
it.rename { "LICENSE_ok_zoomer.md" }
from(licenseFile) {
rename { "LICENSE_ok_zoomer.md" }
}
}

tasks.named('sourcesJar').configure {
inputs.files('LICENSE.md')
sourcesJar {
def licenseFile = rootProject.file('LICENSE.md')
inputs.files(licenseFile)

it.from(rootDir.toPath().resolve('LICENSE.md')) {
it.rename { "LICENSE_ok_zoomer.md" }
from(licenseFile) {
rename { "LICENSE_ok_zoomer.md" }
}
}

Expand Down
42 changes: 6 additions & 36 deletions buildSrc/src/main/groovy/mod_conventions_loader.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,14 @@ plugins {
id 'mod_conventions_common'
}

configurations {
common

commonResources

commonSources

implementation {
extendsFrom(common)
}
}

dependencies {
common(project(":common")) { transitive = false }
commonSources(project(path: ":common", configuration: "sourcesElements")) { transitive = false }
commonResources(project(":common")) {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.RESOURCES))
}
}
}

jar {
from {
configurations.common.collect { zipTree(it) }
}
duplicatesStrategy DuplicatesStrategy.EXCLUDE
dependsOn configurations.common
}

sourcesJar {
from {
configurations.commonSources.collect { zipTree(it) }
compileOnly(project(":common")) {
transitive = false
}
duplicatesStrategy DuplicatesStrategy.EXCLUDE
dependsOn configurations.commonSources
}

processResources {
from(configurations.commonResources)
sourceSets.main {
def common = project(":common").sourceSets.main
java.srcDirs(common.java)
resources.srcDirs(common.resources)
}
20 changes: 13 additions & 7 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ base.archivesName = 'ok_zoomer-fabric'
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work.
dependencies {
minecraft libs.minecraft
mappings loom.officialMojangMappings()
/* mappings(loom.layered {
mappings(loom.layered {
it.officialMojangMappings()
it.parchment libs.parchment
}) */
it.parchment "org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip"
})
modImplementation libs.quilt.loader

modImplementation libs.fabric.api
Expand All @@ -34,9 +33,10 @@ dependencies {
}

loom {
/* if (project(':common').file('src/main/resources/ok_zoomer.accesswidener').exists()) {
accessWidenerPath = project(':common').file('src/main/resources/ok_zoomer.accesswidener')
} */
def atFile = project(':common').file("src/main/resources/${mod_id}.accesswidener")
if (atFile.exists()) {
accessWidenerPath.set(atFile)
}

mixin {
useLegacyMixinAp = false
Expand All @@ -50,6 +50,12 @@ loom {
runDir('run')
}
}

mods {
"${mod_id}" {
sourceSet sourceSets.main
}
}
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"issues": "https://github.com/Up-Mods/OkZoomer/issues",
"sources": "https://github.com/Up-Mods/OkZoomer"
},
"icon": "assets/ok_zoomer/icon.png",
"icon": "icon.png",
"environment": "client",
"entrypoints": {
"client": ["io.github.ennuil.ok_zoomer.OkZoomerClientMod"],
Expand Down
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# The latest versions are available at https://quiltmc.org/en/usage/latest-versions/
[versions]
minecraft = "1.21.3"
parchment = "2024.07.28"

parchment_minecraft = "1.21"
parchment_mappings = "2024.07.28"

quilt_loom = "1.8.4"
quilt_loader = "0.27.0-beta.1"
Expand All @@ -17,7 +19,6 @@ cca = "6.1.1"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
parchment = { module = "org.parchmentmc.data:parchment-1.21", version.ref = "parchment" }
quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" }

fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" }
Expand Down
7 changes: 6 additions & 1 deletion norge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ processResources {
neoForge {
version = libs.versions.neoforge

parchment {
minecraftVersion.set(libs.versions.parchment.minecraft.get())
mappingsVersion.set(libs.versions.parchment.mappings.get())
}

runs {
client {
client()
}
}

mods {
'ok_zoomer' {
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
Expand Down
4 changes: 2 additions & 2 deletions norge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ Adds a highly configurable zoom key. By default, this mod provides its own take
[[dependencies.ok_zoomer]]
modId = "neoforge"
type = "required"
versionRange = "[21.0.0-beta,)"
versionRange = "[21.2.0-beta,)"
ordering = "NONE"
side = "CLIENT"

[[dependencies.ok_zoomer]]
modId = "minecraft"
type = "required"
versionRange = "[1.21.2,1.21.3]"
versionRange = "[1.21.2,1.22)"
ordering = "NONE"
side = "CLIENT"

Expand Down

0 comments on commit f407309

Please sign in to comment.