SquidDev-CC / CCTweaks

Random additions to ComputerCraft (somewhat deprecated, use CC-Tweaked if you're on Minecraft 1.12).
MIT License
12 stars 2 forks source link

OpenPeripheral methods not showing #67

Closed SquidDev closed 9 years ago

SquidDev commented 9 years ago

See http://www.computercraft.info/forums2/index.php?/topic/21987-mc-1710-cc-174-cc-tweaks/page__view__findpost__p__232231

Cannot patch openperipheral.interfaces.cc.ModuleComputerCraft, falling back to default
java.lang.IllegalStateException: Cannot find nodes for methods [Method{<clinit>}]
    LDC "computer"
    LDC Ldan200/computercraft/api/peripheral/IComputerAccess;.class
    INVOKEVIRTUAL openperipheral/adapter/composed/MethodSelector.addProvidedEnv (Ljava/lang/String;Ljava/lang/Class;)Lopenperipheral/adapter/composed/MethodSelector;

    at org.squiddev.patcher.visitors.FindingVisitor.visitEnd(FindingVisitor.java:102) ~[CCTweaks-1.7.10-0.2.2.jar:?]
    at org.objectweb.asm.ClassReader.accept(Unknown Source) ~[asm-all-5.0.3.jar:5.0.3]
    at org.objectweb.asm.ClassReader.accept(Unknown Source) ~[asm-all-5.0.3.jar:5.0.3]
    at org.squiddev.patcher.transformer.TransformationChain.transform(TransformationChain.java:42) ~[CCTweaks-1.7.10-0.2.2.jar:?]
    at org.squiddev.cctweaks.core.asm.ASMTransformer.transform(ASMTransformer.java:121) [CCTweaks-1.7.10-0.2.2.jar:?]

Changed from static constructor to normal constructor

Also, whilst we are doing this I forgot the call to nodes.accept(mv).

SquidDev commented 9 years ago

It might be worth re-writing this to remove the need for ASM injection. The main type we need is the MethodSelector. This is stored in the ClassMethodComposer class which is stored in the ComposedMethodFactory class.

So we need to call PERIPHERAL_METHODS_FACTORY.composer.selector.addProvidedEnv(...). However the composer and selector fields are private.