Rework platform detection logic again

This commit is contained in:
Fury_Phoenix 2023-12-10 16:57:29 -08:00
parent 81d30d595b
commit 47b614e0ef
No known key found for this signature in database
GPG Key ID: 0595F98084987DB8
3 changed files with 6 additions and 10 deletions

View File

@ -18,7 +18,6 @@ dependencies {
// Platform classes // Platform classes
implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
implementation "net.minecraftforge:mergetool:1.1.0" implementation "net.minecraftforge:mergetool:1.1.0"
implementation "net.neoforged:mergetool:2.0.0"
implementation project(":annotations") implementation project(":annotations")
} }

View File

@ -98,15 +98,13 @@ public class ClientMixinValidator {
private boolean isClientMarked(TypeElement te) { private boolean isClientMarked(TypeElement te) {
for (var entry : getPlatformClasses(markers).entrySet()) { for (var entry : getPlatformClasses(markers).entrySet()) {
Annotation marker = te.getAnnotation(entry.getKey()); IAnnotationHandle marker = getAnnotationHandle(te, entry.getKey());
if(marker == null) continue; if(!marker.exists()) continue;
Optional<MethodHandle> accessor = getAccessor(entry.getKey(), entry.getValue()); String[] enumValue = marker.getValue("value");
Optional<String> enumValue = accessor.map((mh) -> this.invoke(mh, marker)) if(enumValue==null) continue;
.map(Object::toString);
if(enumValue.isPresent()) return enumValue[1].equals("CLIENT");
return enumValue.orElseThrow().equals("CLIENT");
return false;
} }
if(debug && unannotatedClasses.add(te.toString())) { if(debug && unannotatedClasses.add(te.toString())) {
messager.printMessage(Diagnostic.Kind.WARNING, messager.printMessage(Diagnostic.Kind.WARNING,

View File

@ -78,5 +78,4 @@ repositories {
url 'https://maven.terraformersmc.com/releases' url 'https://maven.terraformersmc.com/releases'
} }
maven { url = "https://jitpack.io" } maven { url = "https://jitpack.io" }
maven { url "https://maven.neoforged.net/releases" }
} }