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
implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
implementation "net.minecraftforge:mergetool:1.1.0"
implementation "net.neoforged:mergetool:2.0.0"
implementation project(":annotations")
}

View File

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

View File

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