Compare commits

..

No commits in common. "dev" and "v1.0.0" have entirely different histories.
dev ... v1.0.0

5 changed files with 12 additions and 23 deletions

2
.gitattributes vendored
View File

@ -4,7 +4,7 @@
# Linux start script should use lf # Linux start script should use lf
/gradlew text eol=lf /gradlew text eol=lf
* text=auto eol=lf * test=auto eol=lf
# These are Windows script files and should use crlf # These are Windows script files and should use crlf
*.bat text eol=crlf *.bat text eol=crlf

View File

@ -42,7 +42,7 @@ _* Other mods may work without explicit support. Report compatibility requests v
| 1.19.3 | 1.19.3 - 1.19.4 | | 1.19.3 | 1.19.3 - 1.19.4 |
| 1.20 | 1.20 - 1.20.2 | | 1.20 | 1.20 - 1.20.2 |
| 1.20.3 | 1.20.3 - 1.20.6 | | 1.20.3 | 1.20.3 - 1.20.6 |
| 1.21 | 1.21 - 1.21.6 | | 1.21 | 1.21 - 1.21.5 |

View File

@ -119,8 +119,6 @@ tasks.register("buildAll") {
logger.lifecycle("Using Java ${javaToolchain.metadata.javaRuntimeVersion} (path=\"${projectJavaHome}\")") logger.lifecycle("Using Java ${javaToolchain.metadata.javaRuntimeVersion} (path=\"${projectJavaHome}\")")
def failedVersions = new ArrayList<String>()
project.minecraftVersions.each { version -> project.minecraftVersions.each { version ->
logger.lifecycle("================ Building for Minecraft ${version} ================") logger.lifecycle("================ Building for Minecraft ${version} ================")
// TODO: Refactor this (is there a better approach?) // TODO: Refactor this (is there a better approach?)
@ -133,14 +131,11 @@ tasks.register("buildAll") {
def result = execOutput.result.get() def result = execOutput.result.get()
def output = execOutput.standardOutput.asText.get() def output = execOutput.standardOutput.asText.get()
def error = execOutput.standardError.asText.get() def error = execOutput.standardError.asText.get()
logger.lifecycle("[Minecraft ${version}] BUILD ${result.exitValue == 0 ? "SUCCESSFUL" : "FAILED"}. Process exited with code: ${result.exitValue}") logger.lifecycle("[Minecraft ${version}] BUILD ${result.exitValue == 0 ? "SUCCESS" : "FAILED"}. Process exited with code: ${result.exitValue}")
if (result.exitValue != 0) { if (result.exitValue != 0) {
failedVersions.addLast(version as String)
logger.lifecycle("[Minecraft ${version}] Error: ${error}") logger.lifecycle("[Minecraft ${version}] Error: ${error}")
} }
} }
if (!failedVersions.isEmpty()) throw new GradleException("Build failed for Minecraft versions: ${failedVersions.join(", ")}")
} }
} }

View File

@ -6,7 +6,7 @@ org.gradle.parallel=true
version_properties_path=./properties version_properties_path=./properties
# Mod Properties # Mod Properties
mod_version=1.0.1 mod_version=1.0.0
maven_group=cn.revaria.chatplus maven_group=cn.revaria.chatplus
archives_base_name=chat-plus archives_base_name=chat-plus

View File

@ -2,14 +2,11 @@ package cn.revaria.chatplus.plugin;
import cn.revaria.chatplus.plugin.annotation.DisableIfModsLoaded; import cn.revaria.chatplus.plugin.annotation.DisableIfModsLoaded;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import org.spongepowered.asm.service.MixinService;
import org.spongepowered.asm.util.Annotations;
import java.io.IOException; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -26,17 +23,14 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
@Override @Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
try { try {
ClassNode classNode = MixinService.getService().getBytecodeProvider().getClassNode(mixinClassName); Class<?> mixinClass = Class.forName(mixinClassName);
AnnotationNode annotationNode = Annotations.getVisible(classNode, DisableIfModsLoaded.class); DisableIfModsLoaded annotation = mixinClass.getAnnotation(DisableIfModsLoaded.class);
if (annotation != null) {
if (annotationNode == null) { return Arrays.stream(annotation.value()).noneMatch(modId -> FabricLoader.getInstance().isModLoaded(modId));
return true;
} }
return true;
List<String> modIds = Annotations.getValue(annotationNode); } catch (Exception e) {
return modIds.stream().noneMatch(modId -> FabricLoader.getInstance().isModLoaded(modId)); return true;
} catch (IOException | ClassNotFoundException e) {
return false;
} }
} }