Skip to content

Commit 69dae2d

Browse files
committed
remove modfusioner, fix ftbq mixin, rework mixinplugin
1 parent 88ac9f2 commit 69dae2d

File tree

15 files changed

+38
-185
lines changed

15 files changed

+38
-185
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,14 @@ jobs:
2929
chmod +x gradlew
3030
./gradlew build
3131
32-
- name: Merge Fabric & Neoforge JARs
33-
run: |
34-
chmod +x gradlew
35-
./gradlew fusejars
36-
3732
- name: Upload fabric artifacts
3833
uses: actions/upload-artifact@v4
3934
with:
4035
name: fabric-artifacts
4136
path: ${{ github.workspace }}/fabric/build/libs
4237

43-
- name: Upload forge artifacts
44-
uses: actions/upload-artifact@v4
45-
with:
46-
name: forge-artifacts
47-
path: ${{ github.workspace }}/forge/build/libs
48-
4938
- name: Upload neoforge artifacts
5039
uses: actions/upload-artifact@v4
5140
with:
5241
name: neoforge-artifacts
5342
path: ${{ github.workspace }}/neoforge/build/libs
54-
55-
- name: Upload merged artifacts
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: merged
59-
path: ${{ github.workspace }}/build/merged/*

build.gradle

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
plugins {
22
id "architectury-plugin" version "3.4-SNAPSHOT"
3-
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
3+
id "dev.architectury.loom" version "1.11-SNAPSHOT" apply false
44
id "com.gradleup.shadow" version "9.+" apply false
5-
id "com.hypherionmc.modutils.modfusioner" version "1.+"
65
}
76

87
architectury {
@@ -35,29 +34,12 @@ allprojects {
3534
options.release = 21
3635
}
3736

38-
java {
39-
withSourcesJar()
40-
}
41-
}
42-
43-
fusioner {
44-
packageGroup = rootProject.maven_group
45-
mergedJarName = "${rootProject.archives_base_name}.jar"
46-
outputDirectory = "build/merged"
47-
jarVersion = rootProject.version
48-
49-
fabric {
50-
projectName = "fabric"
51-
inputTaskName = "remapJar"
52-
}
53-
54-
forge {
55-
projectName = "forge"
56-
inputTaskName = "remapJar"
37+
repositories {
38+
maven { url 'https://maven.fallenbreath.me/releases' }
39+
maven { url "https://maven.ftb.dev/releases" }
5740
}
5841

59-
neoforge {
60-
projectName = "neoforge"
61-
inputTaskName = "remapJar"
42+
java {
43+
withSourcesJar()
6244
}
6345
}

common/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ architectury {
22
common(rootProject.enabled_platforms.split(","))
33
}
44

5-
repositories {
6-
maven { url "https://maven.ftb.dev/releases" }
7-
}
8-
95
dependencies {
106
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
117
// Do NOT use other classes from fabric loader
128
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
139
modImplementation "dev.ftb.mods:ftb-quests:${rootProject.ftb_quests_version}"
10+
11+
modImplementation "me.fallenbreath:conditional-mixin-common:${rootProject.conditional_mixin_version}"
1412
}

common/src/main/java/com/wulian/texturelocaleredirector/mixin/ftbquests/FTBQMixinPlugin.java renamed to common/src/main/java/com/wulian/texturelocaleredirector/TLRMixinPlugin.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package com.wulian.texturelocaleredirector.mixin.ftbquests;
1+
package com.wulian.texturelocaleredirector;
22

3+
import me.fallenbreath.conditionalmixin.api.mixin.RestrictiveMixinConfigPlugin;
34
import org.objectweb.asm.tree.ClassNode;
4-
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
55
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
66

77
import java.util.List;
88
import java.util.Set;
99

10-
public class FTBQMixinPlugin implements IMixinConfigPlugin {
10+
public class TLRMixinPlugin extends RestrictiveMixinConfigPlugin {
1111
@Override
1212
public void onLoad(String mixinPackage) {
1313
}
@@ -19,10 +19,6 @@ public String getRefMapperConfig() {
1919

2020
@Override
2121
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
22-
if (mixinClassName.endsWith("ChapterImageMixin")) {
23-
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
24-
return classLoader.getResource("dev/ftb/mods/ftbquests/quest/ChapterImage.class") != null;
25-
}
2622
return true;
2723
}
2824

common/src/main/java/com/wulian/texturelocaleredirector/mixin/ftbquests/ChapterImageMixin.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
import com.wulian.texturelocaleredirector.TextureLocaleRedirector;
55
import dev.ftb.mods.ftblibrary.icon.Icon;
66
import dev.ftb.mods.ftbquests.quest.ChapterImage;
7+
import me.fallenbreath.conditionalmixin.api.annotation.Condition;
8+
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
79
import org.spongepowered.asm.mixin.Mixin;
810
import org.spongepowered.asm.mixin.injection.At;
911
import org.spongepowered.asm.mixin.injection.ModifyVariable;
1012

13+
@Restriction(require = @Condition("ftbquests"))
1114
@Mixin(value = ChapterImage.class, remap = false)
1215
public abstract class ChapterImageMixin {
1316

@@ -18,21 +21,31 @@ public abstract class ChapterImageMixin {
1821
)
1922
private Icon injectLocalizedImage(Icon image) {
2023
String currentLang = LangTextureCache.getCurrentLanguage();
21-
if ("en_us".equals(currentLang)) {
24+
25+
if ("en_us".equals(currentLang) || image == null) {
2226
return image;
2327
}
2428

25-
String path = image.toString();
26-
if (path.startsWith("textures/")) {
27-
String localizedPath = "textures/" + currentLang + "/" + path.substring(9);
29+
String originalPath = image.toString();
30+
String texturePrefix = "textures/";
31+
String textureInsert = currentLang + "/";
32+
33+
if (originalPath.contains(texturePrefix + currentLang)) {
34+
TextureLocaleRedirector.LOGGER.warn("{} already exists in {} path.", currentLang, originalPath);
35+
TextureLocaleRedirector.LOGGER.info("ChapterImage icon {}", originalPath);
36+
return image;
37+
} else {
38+
int index = originalPath.indexOf(texturePrefix) + texturePrefix.length();
39+
String localizedPath = originalPath.substring(0, index) + textureInsert + originalPath.substring(index);
40+
2841
Icon localizedIcon = Icon.getIcon(localizedPath);
2942

3043
if (!localizedIcon.isEmpty()) {
31-
TextureLocaleRedirector.LOGGER.info("Redirected ChapterImage icon {} -> {}", path, localizedPath);
44+
TextureLocaleRedirector.LOGGER.info("Redirected ChapterImage icon {} -> {}", originalPath, localizedPath);
3245
return localizedIcon;
46+
} else {
47+
return Icon.getIcon(originalPath.substring(0, index) + originalPath.substring(index));
3348
}
3449
}
35-
36-
return image;
3750
}
3851
}

common/src/main/resources/texturelocaleredirector.mixins.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"required": true,
33
"package": "com.wulian.texturelocaleredirector.mixin",
4-
"plugin": "com.wulian.texturelocaleredirector.mixin.ftbquests.FTBQMixinPlugin",
4+
"plugin": "com.wulian.texturelocaleredirector.TLRMixinPlugin",
55
"compatibilityLevel": "JAVA_21",
66
"minVersion": "0.8",
77
"injectors": {

fabric/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ configurations {
1919
}
2020
}
2121

22-
repositories {
23-
maven { url "https://maven.ftb.dev/releases" }
24-
}
25-
2622
dependencies {
2723
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
2824
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
2925
modApi "dev.ftb.mods:ftb-quests-fabric:${rootProject.ftb_quests_version}"
3026

27+
modImplementation(include("me.fallenbreath:conditional-mixin-fabric:${rootProject.conditional_mixin_version}"))
28+
3129
common(project(path: ":common", configuration: "namedElements")) { transitive false }
3230
shadowBundle(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
3331
}

forge/build.gradle

Lines changed: 0 additions & 72 deletions
This file was deleted.

forge/gradle.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

forge/src/main/java/com/wulian/texturelocaleredirector/forge/TextureLocaleRedirectorClientForge.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)