PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.11.1
Code Block Pro – Beautiful Syntax Highlighting v1.11.1
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / samples / zenscript.sample

zenscript.sample in Code Block Pro – Beautiful Syntax Highlighting 1.11.1, at build/shiki/samples/zenscript.sample

44 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import crafttweaker.api.BracketHandlers;
2
3 val air = <item:minecraft:air>;
4 val diamond = <item:minecraft:diamond>;
5 var woodTypes = ["oak","spruce","birch","jungle","acacia","dark_oak"];
6
7 for name in woodTypes {
8 val thing = BracketHandlers.getItem("minecraft:" + name + "_planks");
9 craftingTable.addShaped(name + "_diamond", diamond, [[air, thing], [thing, air]]);
10 }
11
12 function checkLeapYear(year as int) as bool {
13 if(year % 4 == 0) {
14 if(year % 100 == 0) {
15 if(year % 400 == 0) {
16 return true;
17 } else {
18 return false;
19 }
20 } else {
21 return true;
22 }
23 } else {
24 return false;
25 }
26 }
27
28 print("Is 2000 a leap year: " ~ checkLeapYear(2000));
29 print("Is 2004 a leap year: " ~ checkLeapYear(2004));
30 print("Is 2100 a leap year: " ~ checkLeapYear(2100));
31 print("Is 2012 a leap year: " ~ checkLeapYear(2012));
32
33
34 //Note: this is a cleaner way
35 function checkLeapYear2(year as int) as bool {
36 return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
37 }
38
39 print("Is 2000 a leap year (2nd function): " ~ checkLeapYear2(2000));
40 print("Is 2004 a leap year (2nd function): " ~ checkLeapYear2(2004));
41 print("Is 2100 a leap year (2nd function): " ~ checkLeapYear2(2100));
42 print("Is 2012 a leap year (2nd function): " ~ checkLeapYear2(2012));
43
44 # From https://github.com/CraftTweaker/CraftTweaker-Examples