-
Notifications
You must be signed in to change notification settings - Fork 0
/
Api.h
933 lines (791 loc) · 23.1 KB
/
Api.h
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
std::vector<CTinyJS*> scripts;
std::vector<std::string> mods;
std::vector<std::string> paths;
std::string dump = "";
GuiData*gd;
Level*level;
MinecraftClient*mc;
LocalPlayer*lp;
Minecraft*minecraft;
Vibration*vibration;
Player*_player;
int entityId = 0;
#define Var CScriptVar
Var*var;
Vec3*_vec3;
Vec3*__vec3;
BlockPos*_blockpos;
EntityID*mbid = new EntityID();
std::vector<Font*> fonts;
map<Font*,float> txt_xmap;
map<Font*,float> txt_ymap;
map<Font*,std::string> txt_str;
Item*item;
bool canNewLevel = true;
std::vector<Item*> itemsToSetAttackDamage;
std::vector<int> itemsAttackDamage;
std::vector<int> idsToSetFuel;
std::vector<int> valuesToSetBurnDur;
std::vector<Entity*> entitiesToChested;
std::vector<bool> boolsToChested;
#define getString(name) var->getParameter(name)->getString()
#define getBool(name) var->getParameter(name)->getBool()
#define getInt(name) var->getParameter(name)->getInt()
#define getFloat(name) var->getParameter(name)->getDouble()
#define getArray(name) var->getParameter(name)->getArray()
bool isPreventedDefault;
struct Api{
static void makeAndFixDumpStringData(const std::string& funcname,const std::string& params){
if(dump.find(funcname)==std::string::npos){
dump += "\n"+funcname+"("+params+");";
}
}
static void _makeAndFixDumpStringData(const std::string& funcname){
if(dump.find(funcname)==std::string::npos){
dump += "\n"+funcname+"();";
}
}
static void prepare(){
}
static void add(const std::string &funcname,const std::string¶ms, JSCallback ptr,CTinyJS*js){
makeAndFixDumpStringData(funcname,params);
create("sdcard/dump.txt",dump.c_str());
js->addNative("function "+funcname+"("+params+")",ptr,js);
}
static void add(const std::string &funcname, JSCallback ptr,CTinyJS*js){
_makeAndFixDumpStringData(funcname);
create("sdcard/dump.txt",dump.c_str());
js->addNative("function "+funcname+"()",ptr,js);
}
};
void st1(Var*v,void*data){
isPreventedDefault = true;
}
void e0(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(toStr(entity->entityType+entity->typeId+entity->id)));
}
void e1(Var*v,void*data){
var = v;
v->setReturnVar(new Var(mbid->getId(_player)));
}
void g0(Var*v,void*data){
var = v;
gd->displaySystemMessage(getString("string"));
}
void g1(Var*v,void*data){
var = v;
gd->showPopupNotice(getString("string"),getString("string2"));
}
void g2(Var*v,void*data){
var = v;
Font* font = (Font*)mc->getFont();
txt_str[font] = getString("string");
txt_xmap[font] = getInt("int");
txt_ymap[font] = getInt("int2");
fonts.push_back(font);
}
void m1(Var*v,void*data){
var = v;
v->setReturnVar(new Var(minecraft->isOnlineClient()));
}
void m2(Var*v,void*data){
var = v;
create(getString("string").c_str(),getString("string2").c_str());
}
void m3(Var*v,void*data){
var = v;
v->setReturnVar(new Var(read(getString("string").c_str())));
}
void m4(Var*v,void*data){
var = v;
v->setReturnVar(new Var(fileExists(getString("string").c_str())));
}
void m5(Var*v,void*data){
var = v;
createFolder(getString("string"));
}
void e2(Var*v,void*data){
var = v;
int eid = getInt("entity");
Entity*entity = mbid->getEntity(eid);
entity->jumpFromGround();
}
void e3(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setSneaking(getBool("bool"));
}
void e4(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setSprinting(getBool("bool"));
}
void e5(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->getNameTag()));
}
void e6(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isSurfaceMob()));
}
void e7(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isSneaking()));
}
void e8(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isSprinting()));
}
void e9(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->getHealth()));
}
void e10(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->getMaxHealth()));
}
void e11(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->serializationSetHealth(getInt("int"));
}
void e12(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->_doSprintParticleEffect();
}
void e13(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->_isHeadInWater()));
}
void e14(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setSurfaceMob(getBool("bool"));
}
void e15(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setInvisible(getBool("bool"));
}
void e16(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInvisible()));
}
void e17(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->_isPersistent()));
}
void e18(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->wantsToBeJockey()));
}
void e19(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setWantsToBeJockey(getBool("bool"));
}
void e20(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setFlightSpeed(getInt("float"));
}
void e21(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setSpeed(getInt("float"));
}
void e22(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->getFlightSpeed()));
}
void e23(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->getSpeed()));
}
void e24(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->outOfWorld();
}
void e25(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->ate();
}
void e26(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->setOnFire(getInt("int"));
}
void e27(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->swing();
}
void e28(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->heal(getInt("int"));
}
void e29(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->hurt(*new EntityDamageSource("yeah"),getInt("int"),true,true);
}
void e30(Var*v,void*data){
var = v;
int pid = mbid->getId((Player*)level->getPlayer(getString("string")));
v->setReturnVar(new Var(pid));
}
void e31(Var*v,void*data){
var = v;
Entity*entity = mbid->getEntity(getInt("entity"));
entity->causeFallDamage(getInt("int"));
}
void e32(Var*v,void*data){
var = v;
Entity* entity1 = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
if(entity1!=NULL&&entity2!=NULL){
entity1->setTarget(entity2);
}
}
void e33(Var*v,void*data){
var = v;
Entity* entity1 = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
entity1->doHurtTarget(entity2);
}
void e34(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setCarriedItem(*new ItemInstance(getInt("int"),getInt("int2"),getInt("int3")));
}
void e35(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isLookingAtAnEntity()));
}
void e36(Var*v,void*data){
var = v;
Entity* entity1 = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
entity1->lookAt(entity2,getInt("int"),getFloat("int2"));
}
void e37(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setRot(Vec2{getInt("int"),getInt("int2")});
}
void e38(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(((Vec2*)entity->getRotation())->x));
}
void e39(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(((Vec2*)entity->getRotation())->y));
}
void e40(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(((Vec3*)entity->getPos())->x));
}
void e41(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(((Vec3*)entity->getPos())->y));
}
void e42(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(((Vec3*)entity->getPos())->z));
}
void e43(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setNameTag(getString("string"));
}
void e44(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isRide()));
}
void e45(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
v->setReturnVar(new Var(entity->isRider(*entity2)));
}
void e46(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isOnFire()));
}
void e47(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isAutonomous()));
}
void e48(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setPersistent();
}
void e49(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInWaterOrRain()));
}
void e50(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
entity->killed(entity2);
}
void e51(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
entity->addRider(*entity2);
}
void e52(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
entity->positionRider(*entity2);
}
void e53(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInWater()));
}
void e54(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInWall()));
}
void e55(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInLove()));
}
void e56(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInLava()));
}
void e57(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isBaby()));
}
void e58(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isSitting()));
}
void e59(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isTame()));
}
void e60(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
Entity* entity2 = mbid->getEntity(getInt("entity2"));
entity->setInLove(entity2);
}
void e61(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setCharged(getBool("bool"));
}
void e62(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setPowered(getBool("bool"));
}
void e63(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isPushableByPiston()));
}
void e64(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setSaddle(getBool("bool"));
}
void e65(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isCharged()));
}
void e66(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isInWorld()));
}
void e67(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isPowered()));
}
void e68(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isSheared()));
}
void e69(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->hasSaddle()));
}
void e70(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isChested()));
}
void e71(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isAngry()));
}
void e72(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->isPickable()));
}
void e73(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setNameTagVisible(getBool("bool"));
}
void e74(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
v->setReturnVar(new Var(entity->canShowNameTag()));
}
void e75(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->setSitting(getBool("bool"));
}
void e76(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->addEffect(*new MobEffectInstance(getInt("int"),getInt("int2"),getInt("int3")));
}
void e77(Var*v,void*data){
var = v;
Entity* entity = mbid->getEntity(getInt("entity"));
entity->remove();
}
void e78(Var*v,void*data){
var = v;
int eid = getInt("entity");
if(mbid->isValid(eid)){
var->setReturnVar(new Var(true));
}else{
var->setReturnVar(new Var(false));
}
}
void p1(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
Entity* entity = mbid->getEntity(getInt("entity"));
player->_touch(*entity);
}
void p2(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->openInventory();
}
void p3(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->eat(*new ItemInstance(getInt("int"),getInt("int2"),getInt("int3")));
}
void p4(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->eat(getInt("int"),getFloat("float"));
}
void p5(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
Entity* entity = mbid->getEntity(getInt("entity"));
player->attack(*entity);
}
void p6(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
v->setReturnVar(new Var(player->canStartSleepInBed()));
}
void p7(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->startSleepInBed(*new BlockPos(getFloat("float"),getFloat("float2"),getFloat("float3")));
}
void p8(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->drop(*new ItemInstance(getInt("int"),getInt("int2"),getInt("int3")),getBool("bool"));
}
void p9(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
v->setReturnVar(new Var(((ItemInstance*)player->getSelectedItem())!=NULL?((ItemInstance*)player->getSelectedItem())->getId():-1));
}
void p10(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->setPlayerGameType((GameType)getInt("int"));
mc->setGameMode((GameType)getInt("int"));
}
void p11(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
v->setReturnVar(new Var(player->getGameModeString()));
}
void p12(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
Entity*entity = mbid->getEntity(getInt("entity"));
player->_crit(*entity);
}
void p13(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
Entity*entity = mbid->getEntity(getInt("entity"));
player->interact(*entity);
}
void p14(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
v->setReturnVar(new Var(player->getXpNeededForNextLevel()));
}
void p15(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
v->setReturnVar(new Var(player->hasOpenContainer()));
}
void p16(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
((MinecraftClient*)player->getMinecraftClient())->handleDestoryOrAttackButtonPress();
}
void p17(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
((MinecraftClient*)player->getMinecraftClient())->handleBuildOrInteractButtonPress();
}
void p18(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
((MinecraftClient*)player->getMinecraftClient())->handleDropAllItemsButtonPress();
}
void p19(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->chat(getString("string"));
}
void p20(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
player->add(*new ItemInstance(getInt("int"),getInt("int2"),getInt("int3")));
}
void p21(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
Inventory*inventory = (Inventory*)player->getInventory();
inventory->setContainerSize(getInt("int"));
}
void i1(Var*v,void*data){
var = v;
Player* player = static_cast<Player*>(mbid->getEntity(getInt("player")));
Item::mItems[getInt("int")]->releaseUsing(new ItemInstance(getInt("int2"),getInt("int3"),getInt("int4")),player,getInt("int5"));
}
void i2(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
itemsToSetAttackDamage.push_back(item);
itemsAttackDamage.push_back(getInt("int2"));
}
void i3(Var*v,void*data){
var = v;
Item::addCreativeItem(getInt("int"),getInt("int2"));
}
void i4(Var*v,void*data){
var = v;
idsToSetFuel.push_back(getInt("int"));
valuesToSetBurnDur.push_back(getInt("int2"));
}
void i5(Var*v,void*data){
var = v;
Item::mItems[getInt("int")]->setIcon(getString("string"),getInt("int2"));
}
int (*itemAttackDamageManager$)(Item*);
int (*itemAttackDamageManager2$)(ItemInstance*);
void i6(Var*v,void*data){
var = v;
v->setReturnVar(new Var((new ItemInstance(Item::mItems[getInt("int")]))->getAttackDamage()));
}
void i7(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
item->setCategory((CreativeItemCategory)getInt("int2"));
}
void i8(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
item->setMaxDamage(getInt("int2"));
}
void i9(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
item->setMaxStackSize(getInt("int2"));
}
void i10(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
item->setIsGlint(getBool("bool"));
}
void i11(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
item->_textMatch(getString("string"),getString("string2"),getBool("bool"));
}
void i12(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")];
item->setExplodable(getBool("bool"));
}
void i13(Var*v,void*data){
var = v;
Item*item = Item::mItems[getInt("int")] = new Item(getString("string"),getInt("int") - 4096);
item->setIcon("stick",0);
Item::addCreativeItem(getInt("int"),0);
item->initClientData();
}
void ll1(Var*v,void*data){
var = v;
BlockSource* region = ((BlockSource*)_player->getRegion());
region->setBlockAndData(getInt("int"),getInt("int2"),getInt("int3"),BlockID{getInt("int4")},getInt("int5"),0);
}
void ll2(Var*v,void*data){
var = v;
BlockSource* region = ((BlockSource*)_player->getRegion());
v->getReturnVar()->setString(toStr(region->getBlockID(*new BlockPos(getInt("int"),getInt("int2"),getInt("int3")))));
}
std::string getUUID(){
vector<string> chars = {
"1a","t7","2z","p3","i4","f2","zp","zz","ws","cc","cpp","pk","wt",
"n2","k9","z2","x6","j2a","jd3","saz","sf","as","da","qp","id",
"ll","p1","z3","z5","1zm","ns","dp","kd1","mn","az0","on4","db"
};
int size = chars.size();
return string(chars[rand()%size-1]+chars[rand()%size-1]+chars[rand()%size-1]+chars[rand()%size-1]+chars[rand()%size-1]+chars[rand()%size-1]+chars[rand()%size-1]+chars[rand()%size-1]);
}
map<string,string> types;
map<string,vector<int>> iamap;
map<string,vector<string>> samap;
void array(Var*v,void*data){
var = v;
string uuid = getUUID();
string type = getString("type");
types[uuid] = type;
if(type=="int"){
iamap[uuid] = *new vector<int>();
}else if(type=="string"){
samap[uuid] = *new vector<string>();
}
var->getReturnVar()->setString(uuid);
}
void array_push(Var*v,void*data){
var = v;
string uuid = getString("arr");
string type = types[uuid];
if(type=="int"){
int value = getInt("value");
iamap[uuid].push_back(value);
}else if(type=="string"){
string value = getString("value");
samap[uuid].push_back(value);
}
}
void array_get(Var*v,void*data){
var = v;
string uuid = getString("arr");
string type = types[uuid];
int index = getInt("index");
if(type=="int"){
var->getReturnVar()->setInt(iamap[uuid][index]);
}else if(type=="string"){
var->getReturnVar()->setString(samap[uuid][index]);
}
}
void array_size(Var*v,void*data){
var = v;
string uuid = getString("arr");
string type = types[uuid];
if(type=="int"){
var->getReturnVar()->setInt(iamap[uuid].size());
}else if(type=="string"){
var->getReturnVar()->setInt(samap[uuid].size());
}
}
void array_removeByIndex(Var*v,void*data){
var = v;
string uuid = getString("arr");
string type = types[uuid];
if(type=="int"){
iamap[uuid].erase(iamap[uuid].begin()+getInt("index"));
}else if(type=="string"){
samap[uuid].erase(samap[uuid].begin()+getInt("index"));
}
}
void array_removeByObject(Var*v,void*data){
var = v;
string uuid = getString("arr");
string type = types[uuid];
if(type=="int"){
for(int i = 0;i<iamap[uuid].size();i++){
if(iamap[uuid][i]==getInt("value")){
iamap[uuid].erase(iamap[uuid].begin()+i);
}
}
}else if(type=="string"){
for(int i = 0;i<samap[uuid].size();i++){
if(samap[uuid][i]==getString("value")){
samap[uuid].erase(samap[uuid].begin()+i);
}
}
}
}
void array_removeLast(Var*v,void*data){
var = v;
string uuid = getString("arr");
string type = types[uuid];
if(type=="int"){
iamap[uuid].erase(iamap[uuid].begin()+iamap[uuid].size()-1);
}else if(type=="string"){
samap[uuid].erase(samap[uuid].begin()+samap[uuid].size()-1);
}
}