Skip to content

Commit

Permalink
Update to Loom 0.11, add example common mixin, add common AWs
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Feb 16, 2022
1 parent 1f6ff42 commit 6c43411
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 22 deletions.
2 changes: 2 additions & 0 deletions body.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ The following templates are offered in [Creative Commons Zero v1.0 Universal](ht

Architectury API is added to the templates by default, there are instructions on how to remove them within the buildscripts, depending on the API is **not required** to use the Architectury toolchain.

**Make sure** to do a find everywhere on `examplemod` and replace it with your own mod id.

**Documentation:** [https://docs.architectury.dev/](https://docs.architectury.dev/)
**Discord:** [https://discord.gg/C2RdJDpRBP](https://discord.gg/C2RdJDpRBP)
45 changes: 32 additions & 13 deletions generator.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"filter": "1\\.16\\.5-.*",
"pom": "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml"
},
"FORGE_LOADER_MAJOR": "36"
"FORGE_LOADER_MAJOR": "36",
"MIXIN_FABRIC_BLOCK": ""
}
},
"1.16-architectury-mixin": {
Expand All @@ -81,6 +82,7 @@
],
"inherit_tokens": "1.16-architectury",
"tokens": {
"MIXIN_FABRIC_BLOCK": "\n \"mixins\": [\n \"examplemod.mixins.json\",\n \"examplemod-common.mixins.json\"\n ],",
"MIXIN_COMPAT_LEVEL": "JAVA_8",
"LOOM_FORGE_EXT": "loom {\n forge {\n mixinConfig \"examplemod-common.mixins.json\"\n mixinConfig \"examplemod.mixins.json\"\n }\n}\n"
}
Expand Down Expand Up @@ -139,7 +141,8 @@
"filter": "1\\.17\\.1-.*",
"pom": "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml"
},
"FORGE_LOADER_MAJOR": "37"
"FORGE_LOADER_MAJOR": "37",
"MIXIN_FABRIC_BLOCK": ""
}
},
"1.17-architectury-mixin": {
Expand All @@ -151,41 +154,42 @@
],
"inherit_tokens": "1.17-architectury",
"tokens": {
"MIXIN_FABRIC_BLOCK": "\n \"mixins\": [\n \"examplemod.mixins.json\",\n \"examplemod-common.mixins.json\"\n ],",
"MIXIN_COMPAT_LEVEL": "JAVA_16",
"LOOM_FORGE_EXT": "loom {\n forge {\n mixinConfig \"examplemod-common.mixins.json\"\n mixinConfig \"examplemod.mixins.json\"\n }\n}\n"
}
},
"1.18-forge": {
"description": "1.18 Forge-Only Template",
"description": "1.18.1 Forge-Only Template",
"templates": [
"templates/forge"
],
"tokens": {
"MINECRAFT": "1.18",
"MINECRAFT": "1.18.1",
"JAVA_VERSION": "#JAVA_17",
"COMPILE_JAVA": "#COMPILE_JAVA_17",
"MCMETA_FORMAT": "8",
"JEI_MAJOR": "9s",
"JEI_MAJOR": "9",
"YARN_MAPPINGS": {
"filter": "1\\.18\\+build\\..*",
"filter": "1\\.18\\.1\\+build\\..*",
"pom": "https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml"
},
"FORGE": {
"filter": "1\\.18-.*",
"filter": "1\\.18\\.1-.*",
"pom": "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml"
},
"FORGE_LOADER_MAJOR": "38",
"FORGE_LOADER_MAJOR": "39",
"MIXIN_COMPAT_LEVEL": "JAVA_16"
}
},
"1.18-architectury": {
"description": "1.18 Multi-Loader Template",
"description": "1.18.1 Multi-Loader Template",
"templates": [
"templates/architectury",
"templates/api_new"
],
"tokens": {
"MINECRAFT": "1.18",
"MINECRAFT": "1.18.1",
"JAVA_VERSION": "#JAVA_17",
"COMPILE_JAVA": "#COMPILE_JAVA_17_ARCH",
"FABRIC_LOADER": "#FABRIC_LOADER",
Expand All @@ -198,18 +202,33 @@
"pom": "https://maven.architectury.dev/dev/architectury/architectury/maven-metadata.xml"
},
"YARN_MAPPINGS": {
"filter": "1\\.18\\+build\\..*",
"filter": "1\\.18\\.1\\+build\\..*",
"pom": "https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml"
},
"FABRIC_API": {
"filter": ".*\\+1\\.18",
"pom": "https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/maven-metadata.xml"
},
"FORGE": {
"filter": "1\\.18-.*",
"filter": "1\\.18\\.1-.*",
"pom": "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml"
},
"FORGE_LOADER_MAJOR": "38"
"FORGE_LOADER_MAJOR": "39",
"MIXIN_FABRIC_BLOCK": ""
}
},
"1.18-architectury-mixin": {
"description": "1.18.1 Multi-Loader Template with Mixins",
"templates": [
"templates/architectury",
"templates/api_new",
"templates/mixin"
],
"inherit_tokens": "1.18-architectury",
"tokens": {
"MIXIN_FABRIC_BLOCK": "\n \"mixins\": [\n \"examplemod.mixins.json\",\n \"examplemod-common.mixins.json\"\n ],",
"MIXIN_COMPAT_LEVEL": "JAVA_16",
"LOOM_FORGE_EXT": "loom {\n forge {\n mixinConfig \"examplemod-common.mixins.json\"\n mixinConfig \"examplemod.mixins.json\"\n }\n}\n"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion templates/architectury/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
id "dev.architectury.loom" version "0.11.0-SNAPSHOT" apply false
}

architectury {
Expand Down
4 changes: 4 additions & 0 deletions templates/architectury/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ architectury {
common()
}

loom {
accessWidenerPath = file("src/main/resources/examplemod.accesswidener")
}

publishing {
publications {
mavenCommon(MavenPublication) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"accessWidener": "examplemod.accesswidener"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
accessWidener v2 named
7 changes: 7 additions & 0 deletions templates/architectury/fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ architectury {
fabric()
}

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
Expand Down Expand Up @@ -34,11 +38,14 @@ processResources {
}

shadowJar {
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}

remapJar {
injectAccessWidener = true
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
"main": [
"net.examplemod.fabric.ExampleModFabric"
]
},
},@MIXIN_FABRIC_BLOCK@
"depends": {
"fabric": "*",
"minecraft": ">=@MINECRAFT@",
"architectury": ">=@ARCHITECTURY_API@"
},
"suggests": {
"flamingo": "*"
}
}
10 changes: 10 additions & 0 deletions templates/architectury/forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ architectury {
forge()
}

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath

forge {
convertAccessWideners = true
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
}
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
Expand Down Expand Up @@ -34,6 +43,7 @@ processResources {

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion templates/forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "dev.architectury.loom" version "0.10.0-SNAPSHOT"
id "dev.architectury.loom" version "0.11.0-SNAPSHOT"
id "maven-publish"
}

Expand Down
2 changes: 1 addition & 1 deletion templates/forge/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.examplemod.mixin;

import net.minecraft.client.gui.screens.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(TitleScreen.class)
public class MixinTitleScreen {
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
System.out.println("Hello from example architectury common mixin!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"package": "net.examplemod.mixin",
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
"client": [
"MixinTitleScreen"
],
"mixins": [
],
Expand Down

0 comments on commit 6c43411

Please sign in to comment.