-
Notifications
You must be signed in to change notification settings - Fork 11
/
Block.cs
2146 lines (1924 loc) · 79.9 KB
/
Block.cs
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.Text;
using System.IO;
namespace MCForge
{
public class Block
{
public const byte air = (byte)0;
public const byte rock = (byte)1;
public const byte grass = (byte)2;
public const byte dirt = (byte)3;
public const byte stone = (byte)4;
public const byte wood = (byte)5;
public const byte shrub = (byte)6;
public const byte blackrock = (byte)7;// adminium
public const byte water = (byte)8;
public const byte waterstill = (byte)9;
public const byte lava = (byte)10;
public const byte lavastill = (byte)11;
public const byte sand = (byte)12;
public const byte gravel = (byte)13;
public const byte goldrock = (byte)14;
public const byte ironrock = (byte)15;
public const byte coal = (byte)16;
public const byte trunk = (byte)17;
public const byte leaf = (byte)18;
public const byte sponge = (byte)19;
public const byte glass = (byte)20;
public const byte red = (byte)21;
public const byte orange = (byte)22;
public const byte yellow = (byte)23;
public const byte lightgreen = (byte)24;
public const byte green = (byte)25;
public const byte aquagreen = (byte)26;
public const byte cyan = (byte)27;
public const byte lightblue = (byte)28;
public const byte blue = (byte)29;
public const byte purple = (byte)30;
public const byte lightpurple = (byte)31;
public const byte pink = (byte)32;
public const byte darkpink = (byte)33;
public const byte darkgrey = (byte)34;
public const byte lightgrey = (byte)35;
public const byte white = (byte)36;
public const byte yellowflower = (byte)37;
public const byte redflower = (byte)38;
public const byte mushroom = (byte)39;
public const byte redmushroom = (byte)40;
public const byte goldsolid = (byte)41;
public const byte iron = (byte)42;
public const byte staircasefull = (byte)43;
public const byte staircasestep = (byte)44;
public const byte brick = (byte)45;
public const byte tnt = (byte)46;
public const byte bookcase = (byte)47;
public const byte stonevine = (byte)48;
public const byte obsidian = (byte)49;
public const byte Zero = 0xff;
//Custom blocks
public const byte door_orange_air = (byte)57;
public const byte door_yellow_air = (byte)58;
public const byte door_lightgreen_air = (byte)59;
public const byte door_aquagreen_air = (byte)60;
public const byte door_cyan_air = (byte)61;
public const byte door_lightblue_air = (byte)62;
public const byte door_purple_air = (byte)63;
public const byte door_lightpurple_air = (byte)64;
public const byte door_pink_air = (byte)65;
public const byte door_darkpink_air = (byte)66;
public const byte door_darkgrey_air = (byte)67;
public const byte door_lightgrey_air = (byte)68;
public const byte door_white_air = (byte)69;
public const byte flagbase = (byte)70;
//Seasons
public const byte fallsnow = (byte)71;
public const byte snow = (byte)72;
public const byte fastdeathlava = (byte)73;
public const byte c4 = (byte)74;
public const byte c4det = (byte)75;
public const byte door_cobblestone = (byte)80;
public const byte door_cobblestone_air = (byte)81;
public const byte door_red = (byte)83;
public const byte door_red_air = (byte)84;
public const byte door_orange = (byte)85;
public const byte door_yellow = (byte)86;
public const byte door_lightgreen = (byte)87;
public const byte door_aquagreen = (byte)89;
public const byte door_cyan = (byte)90;
public const byte door_lightblue = (byte)91;
public const byte door_purple = (byte)92;
public const byte door_lightpurple = (byte)93;
public const byte door_pink = (byte)94;
public const byte door_darkpink = (byte)95;
public const byte door_darkgrey = (byte)96;
public const byte door_lightgrey = (byte)97;
public const byte door_white = (byte)98;
public const byte op_glass = (byte)100;
public const byte opsidian = (byte)101;
public const byte op_brick = (byte)102;
public const byte op_stone = (byte)103;
public const byte op_cobblestone = (byte)104;
public const byte op_air = (byte)105;
public const byte op_water = (byte)106;
public const byte op_lava = (byte)107;
public const byte griefer_stone = (byte)108;
public const byte lava_sponge = (byte)109;
public const byte wood_float = (byte)110;
public const byte door = (byte)111;
public const byte lava_fast = (byte)112;
public const byte door2 = (byte)113;
public const byte door3 = (byte)114;
public const byte door4 = (byte)115;
public const byte door5 = (byte)116;
public const byte door6 = (byte)117;
public const byte door7 = (byte)118;
public const byte door8 = (byte)119;
public const byte door9 = (byte)120;
public const byte door10 = (byte)121;
public const byte tdoor = (byte)122;
public const byte tdoor2 = (byte)123;
public const byte tdoor3 = (byte)124;
public const byte tdoor4 = (byte)125;
public const byte tdoor5 = (byte)126;
public const byte tdoor6 = (byte)127;
public const byte tdoor7 = (byte)128;
public const byte tdoor8 = (byte)129;
//Messages
public const byte MsgWhite = (byte)130;
public const byte MsgBlack = (byte)131;
public const byte MsgAir = (byte)132;
public const byte MsgWater = (byte)133;
public const byte MsgLava = (byte)134;
public const byte tdoor9 = (byte)135;
public const byte tdoor10 = (byte)136;
public const byte tdoor11 = (byte)137;
public const byte tdoor12 = (byte)138;
public const byte tdoor13 = (byte)139;
//"finite"
public const byte WaterDown = (byte)140;
public const byte LavaDown = (byte)141;
public const byte WaterFaucet = (byte)143;
public const byte LavaFaucet = (byte)144;
public const byte finiteWater = (byte)145;
public const byte finiteLava = (byte)146;
public const byte finiteFaucet = (byte)147;
public const byte odoor1 = (byte)148;
public const byte odoor2 = (byte)149;
public const byte odoor3 = (byte)150;
public const byte odoor4 = (byte)151;
public const byte odoor5 = (byte)152;
public const byte odoor6 = (byte)153;
public const byte odoor7 = (byte)154;
public const byte odoor8 = (byte)155;
public const byte odoor9 = (byte)156;
public const byte odoor10 = (byte)157;
public const byte odoor11 = (byte)158;
public const byte odoor12 = (byte)159;
//movement
public const byte air_portal = (byte)160;
public const byte water_portal = (byte)161;
public const byte lava_portal = (byte)162;
//Movement doors
public const byte air_door = (byte)164;
public const byte air_switch = (byte)165;
public const byte water_door = (byte)166;
public const byte lava_door = (byte)167;
public const byte odoor1_air = (byte)168;
public const byte odoor2_air = (byte)169;
public const byte odoor3_air = (byte)170;
public const byte odoor4_air = (byte)171;
public const byte odoor5_air = (byte)172;
public const byte odoor6_air = (byte)173;
public const byte odoor7_air = (byte)174;
//portals
public const byte blue_portal = (byte)175;
public const byte orange_portal = (byte)176;
public const byte odoor8_air = (byte)177;
public const byte odoor9_air = (byte)178;
public const byte odoor10_air = (byte)179;
public const byte odoor11_air = (byte)180;
public const byte odoor12_air = (byte)181;
//Explosions
public const byte smalltnt = (byte)182;
public const byte bigtnt = (byte)183;
public const byte tntexplosion = (byte)184;
public const byte fire = (byte)185;
public const byte nuketnt = (byte)186;
public const byte rocketstart = (byte)187;
public const byte rockethead = (byte)188;
public const byte firework = (byte)189;
//Death
public const byte deathlava = (byte)190;
public const byte deathwater = (byte)191;
public const byte deathair = (byte)192;
public const byte activedeathwater = (byte)193;
public const byte activedeathlava = (byte)194;
public const byte magma = (byte)195;
public const byte geyser = (byte)196;
public const byte air_flood = (byte)200;
public const byte door_air = (byte)201;
public const byte air_flood_layer = (byte)202;
public const byte air_flood_down = (byte)203;
public const byte air_flood_up = (byte)204;
public const byte door2_air = (byte)205;
public const byte door3_air = (byte)206;
public const byte door4_air = (byte)207;
public const byte door5_air = (byte)208;
public const byte door6_air = (byte)209;
public const byte door7_air = (byte)210;
public const byte door8_air = (byte)211;
public const byte door9_air = (byte)212;
public const byte door10_air = (byte)213;
public const byte door11_air = (byte)214;
public const byte door12_air = (byte)215;
public const byte door13_air = (byte)216;
public const byte door14_air = (byte)217;
public const byte door_iron = (byte)220;
public const byte door_dirt = (byte)221;
public const byte door_grass = (byte)222;
public const byte door_blue = (byte)223;
public const byte door_book = (byte)224;
public const byte door_iron_air = (byte)225;
public const byte door_dirt_air = (byte)226;
public const byte door_grass_air = (byte)227;
public const byte door_blue_air = (byte)228;
public const byte door_book_air = (byte)229;
public const byte train = (byte)230;
public const byte creeper = (byte)231;
public const byte zombiebody = (byte)232;
public const byte zombiehead = (byte)233;
public const byte birdwhite = (byte)235;
public const byte birdblack = (byte)236;
public const byte birdwater = (byte)237;
public const byte birdlava = (byte)238;
public const byte birdred = (byte)239;
public const byte birdblue = (byte)240;
public const byte birdkill = (byte)242;
public const byte fishgold = (byte)245;
public const byte fishsponge = (byte)246;
public const byte fishshark = (byte)247;
public const byte fishsalmon = (byte)248;
public const byte fishbetta = (byte)249;
public const byte fishlavashark = (byte)250;
public const byte snake = (byte)251;
public const byte snaketail = (byte)252;
public const byte door_gold = (byte)253;
public const byte door_gold_air = (byte)254;
public static List<Blocks> BlockList = new List<Blocks>();
public class Blocks
{
public byte 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 < 256; i++)
{
b = new Blocks();
b.type = (byte)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 door_orange_air:
case door_yellow_air:
case door_lightgreen_air:
case door_aquagreen_air:
case door_cyan_air:
case door_lightblue_air:
case door_purple_air:
case door_lightpurple_air:
case door_pink_air:
case door_darkpink_air:
case door_darkgrey_air:
case door_lightgrey_air:
case door_white_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.Byte(block[0]) == Block.Zero)
{
continue;
}
newBlock.type = Block.Byte(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.Byte(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, byte b) { return canPlace(p.group.Permission, b); }
public static bool canPlace(LevelPermission givenPerm, byte 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(byte type)
{
switch (type)
{
case air:
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(byte type)
{
switch (type)
{
case Block.air:
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(byte 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(byte type)
{
switch (type)
{
// case Block.air:
// 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(byte type, bool countAir = false)
{
if (countAir && type == Block.air) return true;
switch (type)
{
case Block.water:
case Block.lava:
case Block.waterstill:
case Block.lavastill:
return true;
}
return false;
}
public static bool OPBlocks(byte 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(byte 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(byte 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(byte 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(byte 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(byte type)
{
switch (type)
{
case Block.air:
case Block.shrub:
case Block.leaf:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
case Block.redmushroom: