forked from glasss13/CTAutocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasm.d.ts
More file actions
1205 lines (1120 loc) · 32.1 KB
/
Copy pathasm.d.ts
File metadata and controls
1205 lines (1120 loc) · 32.1 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
export {};
declare global {
interface IASM {
readonly INTEGER: string;
readonly DOUBLE: string;
readonly LONG: string;
readonly BOOLEAN: string;
readonly SHORT: string;
readonly CHARACTER: string;
readonly BYTE: string;
readonly OBJECT: string;
readonly STRING: string;
readonly MINECRAFT: string;
readonly ENTITY: string;
readonly ENTITY_FX: string;
readonly ENTITY_ITEM: string;
readonly ENTITY_PLAYER: string;
readonly FILE: string;
readonly FRAME_BUFFER: string;
readonly ICHATCOMPONENT: string;
readonly INVENTORY_PLAYER: string;
readonly ITEM_STACK: string;
readonly PACKET: string;
readonly BLOCK_POS: string;
readonly ENUM_FACING: string;
readonly CANCELLABLE_EVENT: string;
readonly TRIGGER_TYPE: string;
readonly currentModule: string;
JumpCondition: typeof JumpCondition;
AccessType: typeof AccessType;
ARRAY(o: string): string;
L(o: string): string;
At: AtHelper;
desc(returnType: string, ...args: string[]): string;
injectBuilder(
className: string,
methodName: string,
descriptor: string,
at: InjectionPoint,
): InjectBuilder;
removeBuilder(
className: string,
methodName: string,
descriptor: string,
at: InjectionPoint,
): RemoveBuilder;
fieldBuilder(
className: string,
fieldName: string,
descriptor: string,
...accessTypes: AccessType[]
): FieldBuilder;
}
}
declare interface AtHelper {
(
injectionPoint: InjectionPoint,
before?: boolean,
shift?: number,
): InjectionPoint;
HEAD: InjectionPoint["HEAD"];
RETURN: InjectionPoint["RETURN"];
INVOKE: InjectionPoint["INVOKE"];
TAIL: InjectionPoint["TAIL"];
CUSTOM: InjectionPoint["CUSTOM"];
}
declare enum JumpCondition {
TRUE,
FALSE,
EQUAL,
NOT_EQUAL,
LESS_THAN,
GREATER_OR_EQUAL,
GREATER_THAN,
LESS_OR_EQUAL,
NULL,
NON_NULL,
GOTO,
REFS_EQUAL,
REFS_NOT_EQUAL,
}
declare enum AccessType {
PRIVATE,
PUBLIC,
PROTECTED,
STATIC,
FINAL,
}
declare class InjectionPoint {
HEAD: InjectionPoint;
/**
* Injects to where a return operation is made.
*
* Normally, this injects into every return opcode that fits this description, however,
* optionally one can specify the exact opcode to inject to by specifying [ordinal].
* This value (0 indexed) is the index of the operation you want.
*/
RETURN(ordinal?: number): InjectionPoint;
/**
* Injects to where an invoke operation is made.
*
* Normally, this injects into every invoke opcode that fits this description, however,
* optionally one can specify the exact opcode to inject to by specifying [ordinal].
* This value (0 indexed) is the index of the operation you want.
*/
INVOKE(descriptor: Descriptor, ordinal?: number): InjectionPoint;
/**
* Injects into the very very end of a method, before the final return.
*/
TAIL: InjectionPoint;
/**
* Allows the user to find their own injection points. The method node
* to be searched is passed in, and the finder method should return
* a list of nodes to be injected to. The list can be of size >= 0.
*/
CUSTOM(finder: (MethodNode: any) => any[]): InjectionPoint;
}
declare class Descriptor {
constructor(owner: string, name: string, desc: string);
readonly owner: string;
readonly name: string;
readonly desc: string;
}
declare class ASMBuilder {
className: string;
methodName: string;
descriptor: string;
at: InjectionPoint;
constructor(
className: string,
methodName: string,
descriptor: string,
at: InjectionPoint,
);
}
declare class RemoveBuilder extends ASMBuilder {
methodMaps(obj: object): RemoveBuilder;
numberToRemove(numberToRemove: number): RemoveBuilder;
execute(): void;
}
declare class FieldBuilder {
constructor(
className: string,
fieldName: string,
descriptor: string,
accessTypes?: AccessType,
);
initialValue(obj: object): FieldBuilder;
execute(): void;
}
declare class InjectBuilder extends ASMBuilder {
methodMaps(obj: object): InjectBuilder;
fieldMaps(obj: object): InjectBuilder;
instructions(insnList: ($: WrappedInsnListBuilder) => void): InjectBuilder;
execute(): void;
}
// Instruction descriptions from https://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
declare class WrappedInsnListBuilder {
/**
* Invokes an exposed javascript function
*/
invokeJS(functionName: string): WrappedInsnListBuilder;
/**
* load onto the stack a reference from an array
*/
aaload(): WrappedInsnListBuilder;
/**
* store a reference in an array
*/
aastore(): WrappedInsnListBuilder;
/**
* Push a null reference onto the stack
*/
aconst_null(): WrappedInsnListBuilder;
/**
* Load a reference onto the stack from a local variable #index
*/
aload(index: number): WrappedInsnListBuilder;
/**
* create a new array of references of length count and component type identified by the class reference index (indexbyte1 << 8 | indexbyte2) in the constant pool
*/
anewarray(className: string): WrappedInsnListBuilder;
/**
* Return a reference from a method
*/
areturn(): WrappedInsnListBuilder;
/**
* Get the length of an array
*/
arraylength(): WrappedInsnListBuilder;
/**
* Store a reference into a local variable #index
*/
astore(index: number): WrappedInsnListBuilder;
/**
* Throws an error or exception (notice that the rest of the stack is cleared, leaving only a reference to the Throwable)
*/
athrow(): WrappedInsnListBuilder;
/**
* load a byte or Boolean value from an array
*/
baload(): WrappedInsnListBuilder;
/**
* store a byte or Boolean value into an array
*/
bastore(): WrappedInsnListBuilder;
/**
* Push a byte onto the stack as an integer value
*/
bipush(value: number): WrappedInsnListBuilder;
bnewarray(length?: number): WrappedInsnListBuilder;
/**
* load a char from an array
*/
caload(): WrappedInsnListBuilder;
/**
* store a char into an array
*/
castore(): WrappedInsnListBuilder;
/**
* Checks whether an objectref is of a certain type, the
* class reference of which is in the constant pool at
* index (indexbyte1 << 8 | indexbyte2)
*/
checkcast(type: string): WrappedInsnListBuilder;
cnewarray(length?: number): WrappedInsnListBuilder;
/**
* Convert a double to a float
*/
d2f(): WrappedInsnListBuilder;
/**
* Convert a double to an int
*/
d2i(): WrappedInsnListBuilder;
/**
* Convert a double to a long
*/
d2l(): WrappedInsnListBuilder;
/**
* Add two doubles
*/
dadd(): WrappedInsnListBuilder;
/**
* load a double from an array
*/
daload(): WrappedInsnListBuilder;
/**
* store a double into an array
*/
dastore(): WrappedInsnListBuilder;
/**
* Compare two doubles, 1 on NaN
*/
dcmpg(): WrappedInsnListBuilder;
/**
* Compare two doubles, -1 on NaN
*/
dcmpl(): WrappedInsnListBuilder;
/**
* Push the constant 0.0 (a double) onto the stack
*/
dconst_0(): WrappedInsnListBuilder;
/**
* Push the constant 1.0 (a double) onto the stack
*/
dconst_1(): WrappedInsnListBuilder;
/**
* Divide two doubles
*/
ddiv(): WrappedInsnListBuilder;
/**
* Load a double value from a local variable #index
*/
dload(index: number): WrappedInsnListBuilder;
/**
* Multiply two doubles
*/
dmul(): WrappedInsnListBuilder;
/**
* Negate a double
*/
dneg(): WrappedInsnListBuilder;
dnewarray(length?: number): WrappedInsnListBuilder;
/**
* Get the remainder from a division between two doubles
*/
drem(): WrappedInsnListBuilder;
/**
* Return a double from a method
*/
dreturn(): WrappedInsnListBuilder;
/**
* Store a double value into a local variable #index
*/
dstore(index: number): WrappedInsnListBuilder;
/**
* Subtract a double from another
*/
dsub(): WrappedInsnListBuilder;
/**
* Duplicate the value on top of the stack
*/
dup(): WrappedInsnListBuilder;
/**
* Insert a copy of the top value into the stack two values
* from the top. value1 and value2 must not be of the
* type double or long.
*/
dup_x1(): WrappedInsnListBuilder;
/**
* Insert a copy of the top value into the stack two (if
* value2 is double or long it takes up the entry of
* value3, too) or three values (if value2 is neither
* double nor long) from the top
*/
dup_x2(): WrappedInsnListBuilder;
/**
* Duplicate top two stack words (two values, if value1 is
* not double nor long; a single value, if value1 is double
* or long)
*/
dup2(): WrappedInsnListBuilder;
/**
* Duplicate two words and insert beneath third word (see explanation above)
*/
dup2_x1(): WrappedInsnListBuilder;
/**
* Duplicate two words and insert beneath fourth word
*/
dup2_x2(): WrappedInsnListBuilder;
/**
* Convert a float to a double
*/
f2d(): WrappedInsnListBuilder;
/**
* Convert a float to an int
*/
f2i(): WrappedInsnListBuilder;
/**
* Convert a float to a long
*/
f2l(): WrappedInsnListBuilder;
/**
* Add two floats
*/
fadd(): WrappedInsnListBuilder;
/**
* load a float from an array
*/
faload(): WrappedInsnListBuilder;
/**
* store a float in an array
*/
fastore(): WrappedInsnListBuilder;
/**
* Compare two floats, 1 on NaN
*/
fcmpg(): WrappedInsnListBuilder;
/**
* Compare two floats, -1 on NaN
*/
fcmpl(): WrappedInsnListBuilder;
/**
* Push 0.0f on the stack
*/
fconst_0(): WrappedInsnListBuilder;
/**
* Push 1.0f on the stack
*/
fconst_1(): WrappedInsnListBuilder;
/**
* Push 2.0f on the stack
*/
fconst_2(): WrappedInsnListBuilder;
/**
* Divide two floats
*/
fdiv(): WrappedInsnListBuilder;
/**
* Load a float value from a local variable #index
*/
fload(index: number): WrappedInsnListBuilder;
/**
* Multiply two floats
*/
fmul(): WrappedInsnListBuilder;
/**
* Negate a float
*/
fneg(): WrappedInsnListBuilder;
/**
* Get the remainder from a division between two floats
*/
frem(): WrappedInsnListBuilder;
/**
* Return a float
*/
freturn(): WrappedInsnListBuilder;
/**
* Store a float value into a local variable #index
*/
fstore(index: number): WrappedInsnListBuilder;
/**
* Subtract two floats
*/
fsub(): WrappedInsnListBuilder;
/**
* convert an int into a byte
*/
i2b(): WrappedInsnListBuilder;
/**
* convert an int into a character
*/
i2c(): WrappedInsnListBuilder;
/**
* convert an int into a double
*/
i2d(): WrappedInsnListBuilder;
/**
* convert an int into a float
*/
i2f(): WrappedInsnListBuilder;
/**
* convert an int into a long
*/
i2l(): WrappedInsnListBuilder;
/**
* convert an int into a short
*/
i2s(): WrappedInsnListBuilder;
/**
* add two ints
*/
iadd(): WrappedInsnListBuilder;
/**
* load an int from an array
*/
iaload(): WrappedInsnListBuilder;
/**
* perform a bitwise AND on two integers
*/
iand(): WrappedInsnListBuilder;
/**
* store an int into an array
*/
iastore(): WrappedInsnListBuilder;
/**
* load the int value −1 onto the stack
*/
iconst_m1(): WrappedInsnListBuilder;
/**
* load the int value 0 onto the stack
*/
iconst_0(): WrappedInsnListBuilder;
/**
* load the int value 1 onto the stack
*/
iconst_1(): WrappedInsnListBuilder;
/**
* load the int value 2 onto the stack
*/
iconst_2(): WrappedInsnListBuilder;
/**
* load the int value 3 onto the stack
*/
iconst_3(): WrappedInsnListBuilder;
/**
* load the int value 4 onto the stack
*/
iconst_4(): WrappedInsnListBuilder;
/**
* load the int value 5 onto the stack
*/
iconst_5(): WrappedInsnListBuilder;
/**
* divide two integers
*/
idiv(): WrappedInsnListBuilder;
/**
* increment local variable #index by signed byte const
*/
iinc(): WrappedInsnListBuilder;
/**
* Load an int value from a local variable #index
*/
iload(value: number): WrappedInsnListBuilder;
/**
* multiply two integers
*/
imul(): WrappedInsnListBuilder;
/**
* negate int
*/
ineg(): WrappedInsnListBuilder;
inewarray(length?: number): WrappedInsnListBuilder;
/**
* determines if an object objectref is of a given type, identified by class reference index in constant pool (indexbyte1 << 8 | indexbyte2)
*/
instanceof(clazzName: string): WrappedInsnListBuilder;
/**
* bitwise int OR
*/
ior(): WrappedInsnListBuilder;
/**
* logical int remainder
*/
irem(): WrappedInsnListBuilder;
/**
* return an integer from a method
*/
ireturn(): WrappedInsnListBuilder;
/**
* int shift left
*/
ishl(): WrappedInsnListBuilder;
/**
* int arithmetic shift right
*/
ishr(): WrappedInsnListBuilder;
/**
* Store int value into variable #index
*/
istore(vlaue: number): WrappedInsnListBuilder;
/**
* int subtract
*/
isub(): WrappedInsnListBuilder;
/**
* int logical shift right
*/
iushr(): WrappedInsnListBuilder;
/**
* int xor
*/
ixor(): WrappedInsnListBuilder;
/**
* convert a long to a double
*/
l2d(): WrappedInsnListBuilder;
/**
* convert a long to a float
*/
l2f(): WrappedInsnListBuilder;
/**
* convert a long to a int
*/
l2i(): WrappedInsnListBuilder;
/**
* add two longs
*/
ladd(): WrappedInsnListBuilder;
/**
* load a long from an array
*/
laload(): WrappedInsnListBuilder;
/**
* bitwise AND of two longs
*/
land(): WrappedInsnListBuilder;
/**
* store a long to an array
*/
lastore(): WrappedInsnListBuilder;
/**
* push 0 if the two longs are the same, 1 if value1 is greater than value2, -1 otherwise
*/
lcmp(): WrappedInsnListBuilder;
/**
* Push 0L (the number zero with type long) onto the stack
*/
lconst_0(): WrappedInsnListBuilder;
/**
* Push 1L (the number one with type long) onto the stack
*/
lconst_1(): WrappedInsnListBuilder;
/**
* push a constant #index from a constant pool (String, int, float, Class, java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, or a dynamically-computed constant) onto the stack
*/
ldc(constant: any): WrappedInsnListBuilder;
/**
* divide two longs
*/
ldiv(): WrappedInsnListBuilder;
/**
* Load a long value from a local variable #index
*/
lload(value: number): WrappedInsnListBuilder;
/**
* multiply two longs
*/
lmul(): WrappedInsnListBuilder;
/**
* negate a long
*/
lneg(): WrappedInsnListBuilder;
lnewarray(length?: number): WrappedInsnListBuilder;
/**
* bitwise OR of two longs
*/
lor(): WrappedInsnListBuilder;
/**
* remainder of division of two longs
*/
lrem(): WrappedInsnListBuilder;
/**
* return a long value
*/
lreturn(): WrappedInsnListBuilder;
/**
* bitwise shift left of a long value1 by int value2 positions
*/
lshl(): WrappedInsnListBuilder;
/**
* bitwise shift right of a long value1 by int value2 positions
*/
lshr(): WrappedInsnListBuilder;
/**
* store a long value in a local variable #index
*/
lstore(value: number): WrappedInsnListBuilder;
/**
* subtract two longs
*/
lsub(): WrappedInsnListBuilder;
/**
* bitwise shift right of a long value1 by int value2 positions, unsigned
*/
lushr(): WrappedInsnListBuilder;
/**
* bitwise XOR of two longs
*/
lxor(): WrappedInsnListBuilder;
/**
* enter monitor for object ("grab the lock" – start of synchronized() section)
*/
monitorenter(): WrappedInsnListBuilder;
/**
* exit monitor for object ("release the lock" – end of synchronized() section)
*/
monitorexit(): WrappedInsnListBuilder;
/**
* create a new array of dimensions dimensions of type identified by class reference in constant pool index (indexbyte1 << 8 | indexbyte2); the sizes of each dimension is identified by count1, [count2, etc.]
*/
multianewarray(
descriptor: string,
dimensions: number,
): WrappedInsnListBuilder;
/**
* Create new object of type identified by class reference
* in constant pool index (indexbyte1 << 8 |
* indexbyte2)
* In the case of ASMHelper it just uses a string rather than a reference.
*/
new(className: string): WrappedInsnListBuilder;
/**
* create new array with count elements of primitive type identified by atype
*/
newarray(type: number, length?: number): WrappedInsnListBuilder;
/**
* perform no operation
*/
nop(): WrappedInsnListBuilder;
/**
* Discard the top value on the stack
*/
pop(): WrappedInsnListBuilder;
/**
* Discard the top two values on the stack (or one value, if it is a double or long)
*/
pop2(): WrappedInsnListBuilder;
methodReturn(): WrappedInsnListBuilder;
/**
* load short from array
*/
saload(): WrappedInsnListBuilder;
/**
* store short to array
*/
sastore(): WrappedInsnListBuilder;
/**
* push a short onto the stack as an integer value
*/
sipush(): WrappedInsnListBuilder;
snewarray(): WrappedInsnListBuilder;
/**
* Swaps two top words on the stack (note that value1 and value2 must not be double or long)
*/
swap(): WrappedInsnListBuilder;
znewarray(length?: number): WrappedInsnListBuilder;
/**
* Creates a new label, but does not place it anywhere in the bytecode,
* it simply gives you a reference to it.
*/
makeLabel(): LabelNode;
findLabel(n: number): LabelNode;
/**
* Places a previously created label.
*/
placeLabel(label: LabelNode): WrappedInsnListBuilder;
/**
* Jumps to a specificed label based on a condition
*/
jump(condition: JumpCondition, label: LabelNode): WrappedInsnListBuilder;
/**
* Creates a new array of size #size and class #className
*/
array(
size: number,
className: string,
code: ($: ArrayBuilder) => void,
): WrappedInsnListBuilder;
/**
* Gets an instance of a Kotlin Object.
*/
getKObjectInstance(objectClassName: string): WrappedInsnListBuilder;
/**
* Calls an instance method on a Kotlin Object.
*
* Behind the scenes, this produces bytecode that gets the Object instance, and
* then calls the method.
*/
invokeKObjectFunction(
objectClassName: string,
methodName: string,
methodDesc: string,
arguments?: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* An abstraction over iconst, bipush, sipush, and ldc, picking the best one
* available.
*/
int(number: number): WrappedInsnListBuilder;
/**
* An abstraction over fconst and ldc, picking the best one
* available.
*/
double(number: number): WrappedInsnListBuilder;
/**
* An abstraction over fconst and ldc, picking the best one
* available.
*/
float(number: number): WrappedInsnListBuilder;
/**
* An abstraction over lconst and ldc, picking the best one
* available.
*/
long(number: number): WrappedInsnListBuilder;
/**
* Helper for a synchronized block. Synchronizes on the object at the top of the stack
* by entering its monitor at the beginning and exiting its monitor at the end.
* Note that you do not have to maintain the stack height inside the code block for
* this utility to work, as it uses astore/aload.
*/
synchronized(
code: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* Helper for creating an if clause.
*
* Jumps into the provided code if and only if the provided condition(s) is/are TRUE.
* NOTE: This works somewhat inversely to a normal if statement. The code inside the if
* will be SKIPPED if at least ONE of your jump conditions is true. While this may seem counterintuitive,
* it better lines up with how JVM Bytecode actually works.
*
* If you have multiple conditions, they will be called in the order they are passed. Because of that,
* you must set up the stack accordingly.
*
* NOTE: code completion will not be fully correct here due to limitation with rest parameters
*/
ifClause(
conditions: JumpCondition[],
code: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* A helper function to create a new instance of a class.
*
* This is simply a helper wrapper around the sequence of calls necessary to create a new object (new, dup, invokespecial)
*/
createInstance(
className: string,
constructorDescription: string,
parameters: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
ifElseClause(
conditions: JumpCondition[],
builder: ($: IfElseBuilder) => void,
): WrappedInsnListBuilder;
/**
* Get a static field value of a class, where the field is
* identified by field reference in the constant pool index
* (indexbyte1 << 8 | indexbyte2)
* In the case of ASMHelper it just uses a description rather than a reference
*/
getStatic(owner: string, name: string, desc: string): WrappedInsnListBuilder;
/**
* Get a field value of an object objectref, where the field
* is identified by field reference in the constant pool
* index (indexbyte1 << 8 | indexbyte2)
* In the case of ASMHelper it just uses a description rather than a reference
*/
getField(owner: string, name: string, desc: string): WrappedInsnListBuilder;
/**
* Set static field to value in a class, where the field is
* identified by a field reference index in constant pool
* (indexbyte1 << 8 | indexbyte2)
* In the case of ASMHelper it just uses a description rather than a reference
*/
putStatic(owner: string, name: string, desc: string): WrappedInsnListBuilder;
/**
* Set field to value in an object objectref, where the field
* is identified by a field reference index in constant pool
* (indexbyte1 << 8 | indexbyte2)
* In the case of ASMHelper it just uses a description rather than a reference
*/
putField(owner: string, name: string, desc: string): WrappedInsnListBuilder;
/**
* Wrapper over field methods, however it appears the enum FieldAction and constructor for Descriptor are never exposed so this function seems useless
*/
field(action: FieldAction, descriptor: Descriptor): WrappedInsnListBuilder;
/**
* Wrapper over field methods, however it appears the enum FieldAction is never exposed so this function seems useless
*/
field(
action: FieldAction,
owner: string,
name: string,
desc: string,
): WrappedInsnListBuilder;
getLocalField(descriptor: Descriptor): WrappedInsnListBuilder;
updateLocalField(
descriptor: Descriptor,
updater: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
setLocalField(
descriptor: Descriptor,
newValue: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
getLocalField(
owner: string,
name: string,
desc: string,
): WrappedInsnListBuilder;
updateLocalField(
owner: string,
name: string,
desc: string,
updater: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
setLocalField(
owner: string,
name: string,
desc: string,
newValue: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
invoke(
type: InvokeType,
descriptor: Descriptor,
arguments: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* Invoke a static method and puts the result on the stack (might be void); the method is identified by method reference index in constant pool (indexbyte1 << 8 | indexbyte2) In the case of ASMHelper the method is identified by the descriptor
*/
invokeStatic(
owner: string,
name: string,
desc: string,
arguments?: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* Invoke virtual method on object objectref and puts the result on the stack (might be void); the method is identified by method reference index in constant pool (indexbyte1 << 8 | indexbyte2) In the case of ASMHelper the method is identified by the descriptor
*/
invokeVirtual(
owner: string,
name: string,
desc: string,
arguments?: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* Invoke instance method on object objectref and puts the result on the stack (might be void); the method is identified by method reference index in constant pool (indexbyte1 << 8 | indexbyte2) In the case of ASMHelper the method is identified by the descriptor
*/
invokeSpecial(
owner: string,
name: string,
desc: string,
arguments: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* Invokes an interface method on object objectref and puts the result on the stack (might be void); the interface method is identified by method reference index in constant pool (indexbyte1 << 8 | indexbyte2)In the case of ASMHelper the method is identified by the descriptor
*/
invokeInterface(
owner: string,
name: string,
desc: string,
arguments?: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
handle(tag: number, owner: string, name: string, desc: string): Handle;
/**
* Invokes a dynamic method and puts the result on the stack (might be void); the method is identified by method reference index in constant pool (indexbyte1 << 8 | indexbyte2) In the case of ASMHelper the method is identified by the descriptor
*/
invokeDynamic(
name: string,
desc: string,
handle: Handle,
...bootstrapArgs: any[]
): WrappedInsnListBuilder;
/**
* Calls a specified method.
*
* @param owner the name of the owning class. Packages should be separated using slashes.
* @param name the name of the method to call.
* @param desc the method's signature. Ex. (F)Lnet/minecraft/util/Vec3;
*/
invoke(
type: InvokeType,
owner: string,
name: string,
desc: string,
arguments: ($: WrappedInsnListBuilder) => void,
): WrappedInsnListBuilder;
/**
* Helper for table switch statements.
*
* This method allows one to easily create table switch statements. Holes are allowed,
* however they are of course discouraged and should be kept to a minimum. Cases which
* fall into the range but are not present will have their label placed at the default
* code block.
*
* Cases do not have to be ordered correctly, and will have their labels and insn lists
* placed in the order they are called by the user. Cases can fallthrough if desired,
* and will fallthrough in the order defined.
*
* An IllegalStateException will be through if there are no cases, or if there are
* multiple cases with the same index.
*/
tableswitch(builder: ($: SwitchBuilder) => void): WrappedInsnListBuilder;
/**
* Helper for lookup switch statements.
*
* This method allows one to easily create lookup switch statements. Cases do
* not have to be ordered correctly, and will have their labels and insn lists
* placed in the order that they are called by the user. Cases can fallthrough
* if desired, and will fallthrough in the order defined.
*