1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-20 08:27:38 +00:00

Allow disabling generic methods

Suddenly so easy as of the refactoring in 910a63214e395ecae6993d8e0487384c725b3dd3!

Closes #1382
This commit is contained in:
Jonathan Coates
2023-07-09 19:58:34 +01:00
parent 7f25c9a66b
commit af3263dec2
6 changed files with 35 additions and 3 deletions

View File

@@ -24,18 +24,24 @@ import java.util.stream.Stream;
public final class GenericMethod {
private static final Logger LOG = LoggerFactory.getLogger(GenericMethod.class);
final GenericSource source;
final Method method;
final LuaFunction annotation;
final Class<?> target;
final @Nullable PeripheralType peripheralType;
private GenericMethod(Method method, LuaFunction annotation, Class<?> target, @Nullable PeripheralType peripheralType) {
private GenericMethod(GenericSource source, Method method, LuaFunction annotation, Class<?> target, @Nullable PeripheralType peripheralType) {
this.source = source;
this.method = method;
this.annotation = annotation;
this.target = target;
this.peripheralType = peripheralType;
}
public String id() {
return source.id() + "#" + name();
}
public String name() {
return method.getName();
}
@@ -69,7 +75,7 @@ public final class GenericMethod {
var target = Reflect.getRawType(method, types[0], false);
if (target == null) return null;
return new GenericMethod(method, annotation, target, type);
return new GenericMethod(source, method, annotation, target, type);
})
.filter(Objects::nonNull);
}