mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-22 20:09:42 +00:00
Add support for Overwrite annotation on non-obfuscated methods
This commit is contained in:
1 parent
87a3837b13
commit
41e53c4942
5 files changed
+38
-19
No files matched your search
@@ -340,9 +340,9 @@ class AnnotatedMixin {
|
||||
}
|
||||
}
|
||||
|
||||
public void registerOverwrite(ExecutableElement method, AnnotationHandle overwrite) {
|
||||
public void registerOverwrite(ExecutableElement method, AnnotationHandle overwrite, boolean shouldRemap) {
|
||||
this.methods.remove(method);
|
||||
this.overwrites.registerOverwrite(new AnnotatedElementOverwrite(method, overwrite));
|
||||
this.overwrites.registerOverwrite(new AnnotatedElementOverwrite(method, overwrite, shouldRemap));
|
||||
}
|
||||
|
||||
public void registerShadow(VariableElement field, AnnotationHandle shadow, boolean shouldRemap) {
|
||||
|
||||
+13
-8
@@ -45,8 +45,15 @@ class AnnotatedMixinElementHandlerOverwrite extends AnnotatedMixinElementHandler
|
||||
*/
|
||||
static class AnnotatedElementOverwrite extends AnnotatedElement<ExecutableElement> {
|
||||
|
||||
public AnnotatedElementOverwrite(ExecutableElement element, AnnotationHandle annotation) {
|
||||
private final boolean shouldRemap;
|
||||
|
||||
public AnnotatedElementOverwrite(ExecutableElement element, AnnotationHandle annotation, boolean shouldRemap) {
|
||||
super(element, annotation);
|
||||
this.shouldRemap = shouldRemap;
|
||||
}
|
||||
|
||||
public boolean shouldRemap() {
|
||||
return this.shouldRemap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,13 +71,11 @@ class AnnotatedMixinElementHandlerOverwrite extends AnnotatedMixinElementHandler
|
||||
this.validateTargetMethod(elem.getElement(), elem.getAnnotation(), name, "@Overwrite", true, false);
|
||||
this.checkConstraints(elem.getElement(), elem.getAnnotation());
|
||||
|
||||
if (!this.mixin.remap()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (TypeHandle target : this.mixin.getTargets()) {
|
||||
if (!this.registerOverwriteForTarget(elem, target)) {
|
||||
return;
|
||||
if (elem.shouldRemap()) {
|
||||
for (TypeHandle target : this.mixin.getTargets()) {
|
||||
if (!this.registerOverwriteForTarget(elem, target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,8 @@ final class AnnotatedMixins implements IMixinAnnotationProcessor, ITokenProvider
|
||||
return;
|
||||
}
|
||||
|
||||
mixinClass.registerOverwrite(method, AnnotationHandle.of(method, Overwrite.class));
|
||||
AnnotationHandle overwrite = AnnotationHandle.of(method, Overwrite.class);
|
||||
mixinClass.registerOverwrite(method, overwrite, this.shouldRemap(mixinClass, overwrite));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user