aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/init/Intermediary.java
blob: 61494d7161e502aee7e24e5f4264446fb0c36c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package moe.nea.firmament.init;

import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.MappingResolver;
import org.objectweb.asm.Type;

import java.util.List;

public class Intermediary {
    private static final MappingResolver RESOLVER = FabricLoader.getInstance().getMappingResolver();

    static String methodName(Object object) {
        throw new AssertionError("Cannot be called at runtime");
    }

    static <T> String className() {
        throw new AssertionError("Cannot be called at runtime");
    }

    static String id(String source) {
        return source;
    }

//    public record Class(
//        Type intermediaryClass
//    ) {
//        public Class(String intermediaryClass) {
//            this(Type.getObjectType(intermediaryClass.replace('.', '/')));
//        }
//
//        public String getMappedName() {
//            return RESOLVER.mapClassName("intermediary", intermediaryClass.getInternalName()
//                                                                          .replace('/', '.'));
//        }
//    }
//
//    public record Method(
//        Type intermediaryClassName,
//        String intermediaryMethodName,
//        Type intermediaryReturnType,
//        List<Type> intermediaryArgumentTypes
//    ) {
//        public Method(
//            String intermediaryClassName,
//            String intermediaryMethodName,
//            String intermediaryReturnType,
//            String... intermediaryArgumentTypes
//        ) {
//            this(intermediaryClassName, intermediaryMethodName, intermediaryReturnType, List.of(intermediaryArgumentTypes));
//        }
//
//        public String getMappedMethodName() {
//            return RESOLVER.mapMethodName("intermediary",
//                                          intermediaryClassName.getInternalName().replace('/', '.'));
//        }
//
//        public Type getIntermediaryDescriptor() {
//            return Type.getMethodType(intermediaryReturnType, intermediaryArgumentTypes.toArray(Type[]::new));
//        }
//
//
//    }
}