-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBlock.cs
More file actions
2122 lines (1904 loc) · 78.9 KB
/
Block.cs
File metadata and controls
2122 lines (1904 loc) · 78.9 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
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCForge)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using System.IO;
namespace MCForge
{
public class Block
{
public const int maxblocks = 255;
// public const ushort air = (ushort)0;
public const ushort rock = (ushort)1;
public const ushort grass = (ushort)2;
public const ushort dirt = (ushort)3;
public const ushort stone = (ushort)4;
public const ushort wood = (ushort)5;
public const ushort shrub = (ushort)6;
public const ushort blackrock = (ushort)7;// adminium
public const ushort water = (ushort)8;
public const ushort waterstill = (ushort)9;
public const ushort lava = (ushort)10;
public const ushort lavastill = (ushort)11;
public const ushort sand = (ushort)12;
public const ushort gravel = (ushort)13;
public const ushort goldrock = (ushort)14;
public const ushort ironrock = (ushort)15;
public const ushort coal = (ushort)16;
public const ushort trunk = (ushort)17;
public const ushort leaf = (ushort)18;
public const ushort sponge = (ushort)19;
public const ushort glass = (ushort)20;
public const ushort red = (ushort)21;
public const ushort orange = (ushort)22;
public const ushort yellow = (ushort)23;
public const ushort lightgreen = (ushort)24;
public const ushort green = (ushort)25;
public const ushort aquagreen = (ushort)26;
public const ushort cyan = (ushort)27;
public const ushort lightblue = (ushort)28;
public const ushort blue = (ushort)29;
public const ushort purple = (ushort)30;
public const ushort lightpurple = (ushort)31;
public const ushort pink = (ushort)32;
public const ushort darkpink = (ushort)33;
public const ushort darkgrey = (ushort)34;
public const ushort lightgrey = (ushort)35;
public const ushort white = (ushort)36;
public const ushort yellowflower = (ushort)37;
public const ushort redflower = (ushort)38;
public const ushort mushroom = (ushort)39;
public const ushort redmushroom = (ushort)40;
public const ushort goldsolid = (ushort)41;
public const ushort iron = (ushort)42;
public const ushort staircasefull = (ushort)43;
public const ushort staircasestep = (ushort)44;
public const ushort brick = (ushort)45;
public const ushort tnt = (ushort)46;
public const ushort bookcase = (ushort)47;
public const ushort stonevine = (ushort)48;
public const ushort obsidian = (ushort)49;
public const ushort cobblestoneslab = (ushort)50;
public const ushort rope = (ushort)51;
public const ushort sandstone = (ushort)52;
public const ushort snowreal = (ushort)53;
public const ushort firereal = (ushort)54;
public const ushort lightpinkwool = (ushort)55;
public const ushort forestgreenwool = (ushort)56;
public const ushort brownwool = (ushort)57;
public const ushort deepblue = (ushort)58;
public const ushort turquoise = (ushort)59;
public const ushort ice = (ushort)60;
public const ushort ceramictile = (ushort)61;
public const ushort magmablock = (ushort)62;
public const ushort pillar = (ushort)63;
public const ushort crate = (ushort)64;
public const ushort stonebrick = (ushort)65;
public const ushort Zero = 0xff;
public const ushort flagbase = (ushort)70;
//Seasons
public const ushort fallsnow = (ushort)71;
public const ushort snow = (ushort)72;
public const ushort fastdeathlava = (ushort)73;
public const ushort c4 = (ushort)74;
public const ushort c4det = (ushort)75;
public const ushort door_cobblestone = (ushort)80;
public const ushort door_cobblestone_air = (ushort)81;
public const ushort door_red = (ushort)83;
public const ushort door_red_air = (ushort)84;
public const ushort door_orange = (ushort)85;
public const ushort door_yellow = (ushort)86;
public const ushort door_lightgreen = (ushort)87;
public const ushort door_aquagreen = (ushort)89;
public const ushort door_cyan = (ushort)90;
public const ushort door_lightblue = (ushort)91;
public const ushort door_purple = (ushort)92;
public const ushort door_lightpurple = (ushort)93;
public const ushort door_pink = (ushort)94;
public const ushort door_darkpink = (ushort)95;
public const ushort door_darkgrey = (ushort)96;
public const ushort door_lightgrey = (ushort)97;
public const ushort door_white = (ushort)98;
public const ushort op_glass = (ushort)100;
public const ushort opsidian = (ushort)101;
public const ushort op_brick = (ushort)102;
public const ushort op_stone = (ushort)103;
public const ushort op_cobblestone = (ushort)104;
public const ushort op_air = (ushort)105;
public const ushort op_water = (ushort)106;
public const ushort op_lava = (ushort)107;
public const ushort griefer_stone = (ushort)108;
public const ushort lava_sponge = (ushort)109;
public const ushort wood_float = (ushort)110;
public const ushort door = (ushort)111;
public const ushort lava_fast = (ushort)112;
public const ushort door2 = (ushort)113;
public const ushort door3 = (ushort)114;
public const ushort door4 = (ushort)115;
public const ushort door5 = (ushort)116;
public const ushort door6 = (ushort)117;
public const ushort door7 = (ushort)118;
public const ushort door8 = (ushort)119;
public const ushort door9 = (ushort)120;
public const ushort door10 = (ushort)121;
public const ushort tdoor = (ushort)122;
public const ushort tdoor2 = (ushort)123;
public const ushort tdoor3 = (ushort)124;
public const ushort tdoor4 = (ushort)125;
public const ushort tdoor5 = (ushort)126;
public const ushort tdoor6 = (ushort)127;
public const ushort tdoor7 = (ushort)128;
public const ushort tdoor8 = (ushort)129;
//Messages
public const ushort MsgWhite = (ushort)130;
public const ushort MsgBlack = (ushort)131;
public const ushort MsgAir = (ushort)132;
public const ushort MsgWater = (ushort)133;
public const ushort MsgLava = (ushort)134;
public const ushort tdoor9 = (ushort)135;
public const ushort tdoor10 = (ushort)136;
public const ushort tdoor11 = (ushort)137;
public const ushort tdoor12 = (ushort)138;
public const ushort tdoor13 = (ushort)139;
//"finite"
public const ushort WaterDown = (ushort)140;
public const ushort LavaDown = (ushort)141;
public const ushort WaterFaucet = (ushort)143;
public const ushort LavaFaucet = (ushort)144;
public const ushort finiteWater = (ushort)145;
public const ushort finiteLava = (ushort)146;
public const ushort finiteFaucet = (ushort)147;
public const ushort odoor1 = (ushort)148;
public const ushort odoor2 = (ushort)149;
public const ushort odoor3 = (ushort)150;
public const ushort odoor4 = (ushort)151;
public const ushort odoor5 = (ushort)152;
public const ushort odoor6 = (ushort)153;
public const ushort odoor7 = (ushort)154;
public const ushort odoor8 = (ushort)155;
public const ushort odoor9 = (ushort)156;
public const ushort odoor10 = (ushort)157;
public const ushort odoor11 = (ushort)158;
public const ushort odoor12 = (ushort)159;
//movement
public const ushort air_portal = (ushort)160;
public const ushort water_portal = (ushort)161;
public const ushort lava_portal = (ushort)162;
//Movement doors
public const ushort air_door = (ushort)164;
public const ushort air_switch = (ushort)165;
public const ushort water_door = (ushort)166;
public const ushort lava_door = (ushort)167;
public const ushort odoor1_air = (ushort)168;
public const ushort odoor2_air = (ushort)169;
public const ushort odoor3_air = (ushort)170;
public const ushort odoor4_air = (ushort)171;
public const ushort odoor5_air = (ushort)172;
public const ushort odoor6_air = (ushort)173;
public const ushort odoor7_air = (ushort)174;
//portals
public const ushort blue_portal = (ushort)175;
public const ushort orange_portal = (ushort)176;
public const ushort odoor8_air = (ushort)177;
public const ushort odoor9_air = (ushort)178;
public const ushort odoor10_air = (ushort)179;
public const ushort odoor11_air = (ushort)180;
public const ushort odoor12_air = (ushort)181;
//Explosions
public const ushort smalltnt = (ushort)182;
public const ushort bigtnt = (ushort)183;
public const ushort tntexplosion = (ushort)184;
public const ushort fire = (ushort)185;
public const ushort nuketnt = (ushort)186;
public const ushort rocketstart = (ushort)187;
public const ushort rockethead = (ushort)188;
public const ushort firework = (ushort)189;
//Death
public const ushort deathlava = (ushort)190;
public const ushort deathwater = (ushort)191;
public const ushort deathair = (ushort)192;
public const ushort activedeathwater = (ushort)193;
public const ushort activedeathlava = (ushort)194;
public const ushort magma = (ushort)195;
public const ushort geyser = (ushort)196;
public const ushort air_flood = (ushort)200;
public const ushort door_air = (ushort)201;
public const ushort air_flood_layer = (ushort)202;
public const ushort air_flood_down = (ushort)203;
public const ushort air_flood_up = (ushort)204;
public const ushort door2_air = (ushort)205;
public const ushort door3_air = (ushort)206;
public const ushort door4_air = (ushort)207;
public const ushort door5_air = (ushort)208;
public const ushort door6_air = (ushort)209;
public const ushort door7_air = (ushort)210;
public const ushort door8_air = (ushort)211;
public const ushort door9_air = (ushort)212;
public const ushort door10_air = (ushort)213;
public const ushort door11_air = (ushort)214;
public const ushort door12_air = (ushort)215;
public const ushort door13_air = (ushort)216;
public const ushort door14_air = (ushort)217;
public const ushort door_iron = (ushort)220;
public const ushort door_dirt = (ushort)221;
public const ushort door_grass = (ushort)222;
public const ushort door_blue = (ushort)223;
public const ushort door_book = (ushort)224;
public const ushort door_iron_air = (ushort)225;
public const ushort door_dirt_air = (ushort)226;
public const ushort door_grass_air = (ushort)227;
public const ushort door_blue_air = (ushort)228;
public const ushort door_book_air = (ushort)229;
public const ushort train = (ushort)230;
public const ushort creeper = (ushort)231;
public const ushort zombiebody = (ushort)232;
public const ushort zombiehead = (ushort)233;
public const ushort birdwhite = (ushort)235;
public const ushort birdblack = (ushort)236;
public const ushort birdwater = (ushort)237;
public const ushort birdlava = (ushort)238;
public const ushort birdred = (ushort)239;
public const ushort birdblue = (ushort)240;
public const ushort birdkill = (ushort)242;
public const ushort fishgold = (ushort)245;
public const ushort fishsponge = (ushort)246;
public const ushort fishshark = (ushort)247;
public const ushort fishsalmon = (ushort)248;
public const ushort fishbetta = (ushort)249;
public const ushort fishlavashark = (ushort)250;
public const ushort snake = (ushort)251;
public const ushort snaketail = (ushort)252;
public const ushort door_gold = (ushort)253;
public const ushort door_gold_air = (ushort)254;
public static List<Blocks> BlockList = new List<Blocks>();
public class Blocks
{
public ushort? type;
public LevelPermission lowestRank;
public List<LevelPermission> disallow = new List<LevelPermission>();
public List<LevelPermission> allow = new List<LevelPermission>();
public bool IncludeInBlockProperties()
{
if (Block.Name(type).ToLower() == "unknown")
return false;
if(type == Block.flagbase)
return false;
if (type >= Block.odoor1_air && type <= Block.odoor7_air)
return false;
if (type >= Block.odoor8_air && type <= Block.odoor12_air)
return false;
return true;
}
}
public static void SetBlocks()
{
BlockList = new List<Blocks>();
Blocks b = new Blocks();
b.lowestRank = LevelPermission.Guest;
for (int i = 0; i < (maxblocks+ 1); i++)
{
b = new Blocks();
b.type = (ushort)i;
BlockList.Add(b);
}
List<Blocks> storedList = new List<Blocks>();
foreach (Blocks bs in BlockList)
{
b = new Blocks();
b.type = bs.type;
switch (bs.type)
{
case Zero:
b.lowestRank = LevelPermission.Admin;
break;
case op_glass:
case opsidian:
case op_brick:
case op_stone:
case op_cobblestone:
case op_air:
case op_water:
case op_lava:
case blackrock:
case griefer_stone:
case air_flood:
case air_flood_down:
case air_flood_layer:
case air_flood_up:
case bigtnt:
case nuketnt:
case rocketstart:
case rockethead:
case creeper:
case zombiebody:
case zombiehead:
case birdred:
case birdkill:
case birdblue:
case fishgold:
case fishsponge:
case fishshark:
case fishsalmon:
case fishbetta:
case fishlavashark:
case snake:
case snaketail:
case flagbase:
b.lowestRank = LevelPermission.Operator;
break;
case wood_float:
case lava_sponge:
case door_air:
case door2_air:
case door3_air:
case door4_air:
case door5_air:
case door6_air:
case door7_air:
case door8_air:
case door9_air:
case door10_air:
case door11_air:
case door12_air:
case door13_air:
case door14_air:
case door_iron_air:
case door_gold_air:
case door_cobblestone_air:
case door_red_air:
case door_grass_air:
case door_dirt_air:
case door_blue_air:
case door_book_air:
case odoor1_air:
case odoor2_air:
case odoor3_air:
case odoor4_air:
case odoor5_air:
case odoor6_air:
case odoor7_air:
case odoor8_air:
case odoor9_air:
case odoor10_air:
case odoor11_air:
case odoor12_air:
case MsgAir:
case MsgBlack:
case MsgLava:
case MsgWater:
case MsgWhite:
case air_portal:
case water_portal:
case lava_portal:
case blue_portal:
case orange_portal:
case water:
case lava:
case lava_fast:
case WaterDown:
case LavaDown:
case WaterFaucet:
case LavaFaucet:
case finiteWater:
case finiteLava:
case finiteFaucet:
case magma:
case geyser:
case deathlava:
case deathwater:
case deathair:
case activedeathwater:
case activedeathlava:
case fastdeathlava:
case fire:
case c4:
case c4det:
case smalltnt:
case tntexplosion:
case firework:
case train:
case birdwhite:
case birdblack:
case birdwater:
case birdlava:
b.lowestRank = LevelPermission.AdvBuilder;
break;
case door:
case door2:
case door3:
case door4:
case door5:
case door6:
case door7:
case door8:
case door9:
case door10:
case air_door:
case air_switch:
case water_door:
case lava_door:
case door_iron:
case door_gold:
case door_grass:
case door_dirt:
case door_blue:
case door_book:
case door_cobblestone:
case door_red:
case door_orange:
case door_yellow:
case door_lightgreen:
case door_aquagreen:
case door_cyan:
case door_lightblue:
case door_purple:
case door_lightpurple:
case door_pink:
case door_darkpink:
case door_darkgrey:
case door_lightgrey:
case door_white:
case tdoor:
case tdoor2:
case tdoor3:
case tdoor4:
case tdoor5:
case tdoor6:
case tdoor7:
case tdoor8:
case tdoor9:
case tdoor10:
case tdoor11:
case tdoor12:
case tdoor13:
case odoor1:
case odoor2:
case odoor3:
case odoor4:
case odoor5:
case odoor6:
case odoor7:
case odoor8:
case odoor9:
case odoor10:
case odoor11:
case odoor12:
b.lowestRank = LevelPermission.Builder;
break;
default:
b.lowestRank = LevelPermission.Banned;
break;
}
storedList.Add(b);
}
//CHECK FOR SPECIAL RANK ALLOWANCES SET BY USER
if (File.Exists("properties/block.properties"))
{
string[] lines = File.ReadAllLines("properties/block.properties");
//if (lines.Length == 0) ; // this is useless?
/*else */if (lines[0] == "#Version 2")
{
string[] colon = new string[] { " : " };
foreach (string line in lines)
{
if (line != "" && line[0] != '#')
{
//Name : Lowest : Disallow : Allow
string[] block = line.Split(colon, StringSplitOptions.None);
Blocks newBlock = new Blocks();
if (Block.Ushort(block[0]) == Block.Zero)
{
continue;
}
newBlock.type = Block.Ushort(block[0]);
string[] disallow = new string[0];
if (block[2] != "")
disallow = block[2].Split(',');
string[] allow = new string[0];
if (block[3] != "")
allow = block[3].Split(',');
try
{
newBlock.lowestRank = (LevelPermission)int.Parse(block[1]);
foreach (string s in disallow) { newBlock.disallow.Add((LevelPermission)int.Parse(s)); }
foreach (string s in allow) { newBlock.allow.Add((LevelPermission)int.Parse(s)); }
}
catch
{
Server.s.Log("Hit an error on the block " + line);
continue;
}
int current = 0;
foreach (Blocks bS in storedList)
{
if (newBlock.type == bS.type)
{
storedList[current] = newBlock;
break;
}
current++;
}
}
}
}
else
{
foreach (string s in lines)
{
if (s[0] != '#')
{
try
{
Blocks newBlock = new Blocks();
newBlock.type = Block.Ushort(s.Split(' ')[0]);
newBlock.lowestRank = Level.PermissionFromName(s.Split(' ')[2]);
if (newBlock.lowestRank != LevelPermission.Null)
storedList[storedList.FindIndex(sL => sL.type == newBlock.type)] = newBlock;
else
throw new Exception();
}
catch { Server.s.Log("Could not find the rank given on " + s + ". Using default"); }
}
}
}
}
BlockList.Clear();
BlockList.AddRange(storedList);
SaveBlocks(BlockList);
}
public static void SaveBlocks(List<Blocks> givenList)
{
try
{
using (StreamWriter w = File.CreateText("properties/block.properties"))
{
w.WriteLine("#Version 2");
w.WriteLine("# This file dictates what levels may use what blocks");
w.WriteLine("# If someone has royally screwed up the ranks, just delete this file and let the server restart");
w.WriteLine("# Allowed ranks: " + Group.concatList(false, false, true));
w.WriteLine("# Disallow and allow can be left empty, just make sure there's 2 spaces between the colons");
w.WriteLine("# This works entirely on permission values, not names. Do not enter a rank name. Use it's permission value");
w.WriteLine("# BlockName : LowestRank : Disallow : Allow");
w.WriteLine("# lava : 60 : 80,67 : 40,41,55");
w.WriteLine("");
foreach (Blocks bs in givenList)
{
if (bs.IncludeInBlockProperties())
{
string line = Block.Name(bs.type) + " : " + (int)bs.lowestRank + " : " + GrpCommands.getInts(bs.disallow) + " : " + GrpCommands.getInts(bs.allow);
w.WriteLine(line);
}
}
}
}
catch (Exception e) { Server.ErrorLog(e); }
}
public static bool canPlace(Player p, ushort? b) { return canPlace(p.group.Permission, b); }
public static bool canPlace(LevelPermission givenPerm, ushort? givenBlock)
{
foreach (Blocks b in BlockList)
{
if (givenBlock == b.type)
{
if ((b.lowestRank <= givenPerm && !b.disallow.Contains(givenPerm)) || b.allow.Contains(givenPerm)) return true;
return false;
}
}
return false;
}
public static bool Walkthrough(ushort? type)
{
switch (type)
{
case null:
case water:
case waterstill:
case lava:
case lavastill:
case yellowflower:
case redflower:
case mushroom:
case redmushroom:
case shrub:
return true;
}
return false;
}
public static bool AnyBuild(ushort? type)
{
switch (type)
{
case null:
case Block.rock:
case Block.grass:
case Block.dirt:
case Block.stone:
case Block.wood:
case Block.shrub:
case Block.sand:
case Block.gravel:
case Block.goldrock:
case Block.ironrock:
case Block.coal:
case Block.trunk:
case Block.leaf:
case Block.sponge:
case Block.glass:
case Block.red:
case Block.orange:
case Block.yellow:
case Block.lightgreen:
case Block.green:
case Block.aquagreen:
case Block.cyan:
case Block.lightblue:
case Block.blue:
case Block.purple:
case Block.lightpurple:
case Block.pink:
case Block.darkpink:
case Block.darkgrey:
case Block.lightgrey:
case Block.white:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
case Block.redmushroom:
case Block.goldsolid:
case Block.iron:
case Block.staircasefull:
case Block.staircasestep:
case Block.brick:
case Block.tnt:
case Block.bookcase:
case Block.stonevine:
case Block.obsidian:
return true;
}
return false;
}
public static bool AllowBreak(ushort? type)
{
switch (type)
{
case Block.blue_portal:
case Block.orange_portal:
case Block.MsgWhite:
case Block.MsgBlack:
case Block.door:
case Block.door2:
case Block.door3:
case Block.door4:
case Block.door5:
case Block.door6:
case Block.door7:
case Block.door8:
case Block.door9:
case Block.door10:
case door_iron:
case door_gold:
case door_dirt:
case door_grass:
case door_blue:
case door_book:
case door_cobblestone:
case door_red:
case door_orange:
case door_yellow:
case door_lightgreen:
case door_aquagreen:
case door_cyan:
case door_lightblue:
case door_purple:
case door_lightpurple:
case door_pink:
case door_darkpink:
case door_darkgrey:
case door_lightgrey:
case door_white:
case Block.c4:
case Block.smalltnt:
case Block.bigtnt:
case Block.nuketnt:
case Block.rocketstart:
case Block.firework:
case zombiebody:
case creeper:
case zombiehead:
return true;
}
return false;
}
public static bool Placable(ushort? type)
{
switch (type)
{
// case null:
// case Block.grass:
case Block.blackrock:
case Block.water:
case Block.waterstill:
case Block.lava:
case Block.lavastill:
return false;
}
if (type > 49) { return false; }
return true;
}
public static bool RightClick(ushort? type, bool countAir = false)
{
if (countAir && type == null) return true;
switch (type)
{
case Block.water:
case Block.lava:
case Block.waterstill:
case Block.lavastill:
return true;
}
return false;
}
public static bool OPBlocks(ushort? type)
{
switch (type)
{
case Block.blackrock:
case Block.op_air:
case Block.op_brick:
case Block.op_cobblestone:
case Block.op_glass:
case Block.op_stone:
case Block.op_water:
case Block.op_lava:
case Block.opsidian:
case Block.rocketstart:
case Block.Zero:
return true;
}
return false;
}
public static bool Death(ushort? type)
{
switch (type)
{
case Block.tntexplosion:
case Block.deathwater:
case Block.deathlava:
case Block.deathair:
case activedeathlava:
case activedeathwater:
case fastdeathlava:
case Block.magma:
case Block.geyser:
case Block.birdkill:
case fishshark:
case fishlavashark:
case train:
case snake:
case fire:
case rockethead:
case creeper:
case zombiebody:
//case zombiehead:
return true;
}
return false;
}
public static bool BuildIn(ushort? type)
{
if (type == op_water || type == op_lava || Block.portal(type) || Block.mb(type)) return false;
switch (Block.Convert(type))
{
case water:
case lava:
case waterstill:
case lavastill:
return true;
}
return false;
}
public static bool Mover(ushort? type)
{
switch (type)
{
case Block.air_portal:
case Block.water_portal:
case Block.lava_portal:
case Block.air_switch:
case Block.water_door:
case Block.lava_door:
case Block.MsgAir:
case Block.MsgWater:
case Block.MsgLava:
case Block.flagbase:
return true;
}
return false;
}
public static bool LavaKill(ushort? type)
{
switch (type)
{
case Block.wood:
case Block.shrub:
case Block.trunk:
case Block.leaf:
case Block.sponge:
case Block.red:
case Block.orange:
case Block.yellow:
case Block.lightgreen:
case Block.green:
case Block.aquagreen:
case Block.cyan:
case Block.lightblue:
case Block.blue:
case Block.purple:
case Block.lightpurple:
case Block.pink:
case Block.darkpink:
case Block.darkgrey:
case Block.lightgrey:
case Block.white:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
case Block.redmushroom:
case Block.bookcase:
return true;
}
return false;
}
public static bool WaterKill(ushort? type)
{
switch (type)
{
case null:
case Block.shrub:
case Block.leaf:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
case Block.redmushroom:
return true;
}
return false;
}
public static bool LightPass(ushort? type)
{
switch (Convert(type))
{
case null:
case Block.glass: