};
m.accept(mv);
node.methods.set(node.methods.indexOf(m), mv);
}
if(m.name.equals("updateSignalStateForColor")) {
InsnList list = m.instructions;
AbstractInsnNode current = list.getLast();
while(!(current instanceof InsnNode && ((InsnNode)current).getOpcode() == Opcodes.RETURN)) {
current = current.getPrevious();
}
current = current.getPrevious();
InsnList toAdd = new InsnList();
toAdd.add(new VarInsnNode(Opcodes.ALOAD, 0));
toAdd.add(new VarInsnNode(Opcodes.ALOAD, 1));
toAdd.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "logisticspipes/proxy/buildcraft/BCPipeWireHooks", "updateSignalStateForColor", "(Lbuildcraft/transport/Pipe;Lbuildcraft/api/transport/PipeWire;)V"));
toAdd.add(getLabelNode(new Label()));
m.instructions.insert(current, toAdd);
}
if(m.name.equals("readNearbyPipesSignal")) {
MethodNode mv = new MethodNode(Opcodes.ASM4, m.access, m.name, m.desc, m.signature, m.exceptions.toArray(new String[0])) {
boolean handled = false;
@Override
public void visitInsn(int opcode) {
if(!handled) {
handled = true;
super.visitVarInsn(Opcodes.ALOAD, 0);
super.visitVarInsn(Opcodes.ALOAD, 1);
super.visitMethodInsn(Opcodes.INVOKESTATIC, "logisticspipes/proxy/buildcraft/BCPipeWireHooks", "readNearbyPipesSignal_Pre", "(Lbuildcraft/transport/Pipe;Lbuildcraft/api/transport/PipeWire;)Z");
} else {
super.visitInsn(opcode);
}
}
};
m.accept(mv);
InsnList list = mv.instructions;
AbstractInsnNode current = list.getLast();
while(!(current instanceof InsnNode && ((InsnNode)current).getOpcode() == Opcodes.RETURN)) {
current = current.getPrevious();
}
current = current.getPrevious();
InsnList toAdd = new InsnList();
toAdd.add(new VarInsnNode(Opcodes.ALOAD, 0));
toAdd.add(new VarInsnNode(Opcodes.ALOAD, 1));
toAdd.add(new VarInsnNode(Opcodes.ILOAD, 2));
toAdd.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "logisticspipes/proxy/buildcraft/BCPipeWireHooks", "readNearbyPipesSignal_Post", "(Lbuildcraft/transport/Pipe;Lbuildcraft/api/transport/PipeWire;Z)V"));
toAdd.add(getLabelNode(new Label()));
mv.instructions.insert(current, toAdd);
node.methods.set(node.methods.indexOf(m), mv);
}
if(m.name.equals("receiveSignal")) {