Skip to content

Commit

Permalink
Use a mixin config plugin to load Mixin Extras on Forge.
Browse files Browse the repository at this point in the history
* Tidy the build files a bit more
- Work around Forge's Mixin Extras loading problem
  • Loading branch information
gniftygnome committed Dec 31, 2023
1 parent 5534925 commit 370636d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: chmod +x ./gradlew
- name: Build
#run: ./gradlew generateChangelog build publish publishMods -Pgithub -Pmodrinth -Pcurseforge -Pdiscord -PlastTag="v${{ github.event.inputs.previousVersion }}" -PcurrentTag="v${{ github.event.inputs.version }}" --stacktrace
run: ./gradlew generateChangelog build publish publishMods -Pgithub -PlastTag="v${{ github.event.inputs.previousVersion }}" -PcurrentTag="v${{ github.event.inputs.version }}" --stacktrace
run: ./gradlew generateChangelog build publish -PlastTag="v${{ github.event.inputs.previousVersion }}" -PcurrentTag="v${{ github.event.inputs.version }}" --stacktrace
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down
6 changes: 3 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ dependencies {
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
common(project(path: ":common", configuration: "namedElements")) { transitive = false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive = false }

// TerraBlender so we can target it with mixins
// TerraBlender so we can use its API
modCompileOnly "com.github.glitchfiend:TerraBlender-fabric:${rootProject.terrablender_version}"

// Terraform Surfaces API for OpenSimplexNoise
Expand Down
4 changes: 2 additions & 2 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ dependencies {
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.mixinextras_version}"))
implementation(include("io.github.llamalad7:mixinextras-forge:${rootProject.mixinextras_version}"))

common(project(path: ":common", configuration: "namedElements")) { transitive false }
common(project(path: ":common", configuration: "namedElements")) { transitive = false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }

// TerraBlender so we can target it with mixins
// TerraBlender so we can use its API
modCompileOnly "com.github.glitchfiend:TerraBlender-forge:${rootProject.terrablender_version}"

// Terraform Surfaces API for OpenSimplexNoise
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.terraformersmc.biolith.impl.mixin;

import com.llamalad7.mixinextras.MixinExtrasBootstrap;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

public class BiolithForgeMixinConfigPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
MixinExtrasBootstrap.init();
}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return true;
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
}

@Override
public List<String> getMixins() {
return null;
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
}
1 change: 1 addition & 0 deletions forge/src/main/resources/biolith.forge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"minVersion": "0.8",
"package": "com.terraformersmc.biolith.impl.mixin",
"compatibilityLevel": "JAVA_17",
"plugin": "com.terraformersmc.biolith.impl.mixin.BiolithForgeMixinConfigPlugin",
"mixins": [
],
"client": [
Expand Down
4 changes: 2 additions & 2 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ dependencies {
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
common(project(path: ":common", configuration: "namedElements")) { transitive = false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }

// TerraBlender so we can target it with mixins
// TerraBlender so we can use its API
modCompileOnly "com.github.glitchfiend:TerraBlender-neoforge:${rootProject.terrablender_version}"

// Terraform Surfaces API for OpenSimplexNoise
Expand Down

0 comments on commit 370636d

Please sign in to comment.