-
Notifications
You must be signed in to change notification settings - Fork 1
/
craft.test.zs
120 lines (95 loc) · 3.71 KB
/
craft.test.zs
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
/*
Craft.zs tests
Dev-only file. Please remove it.
*/
#norun
import crafttweaker.item.IIngredient;
import crafttweaker.item.IItemStack;
import crafttweaker.recipes.IRecipeFunction;
import scripts.craft.grid.Grid;
import scripts.craft.craft_extension.Extension;
logger.logError("craftzs_tests.zs is dev-only file. Please remove it.");
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
print("~~~ Craft.zs Tests");
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
craft.remake(<minecraft:chest> * 4, ["pretty",
"# # #",
"# #",
"# # #"], {
"#": <ore:logWood>,
});
# [Chest]*64 from [Oak Wood]
craft.remake(<minecraft:chest> * 64, ["pretty",
"# # # # # # #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# # # # # # #"], {
"#": <ore:logWood>, # Oak Wood
});
for i in 0 .. 5 {
print("~~~~~~~~~~~~~~~~~~~~~~~~");
print("~~ Test cycle #"~i);
val output = itemUtils.getItem("minecraft:planks", i) * 4;
val gridLine = serialize.repeat("ABC", i);
val gridStr = [i%2==0?"pretty":"",serialize.repeat("AB C", i),"A C","A B C"] as string[];
val options = {"A": <ore:logWood>,"B": <ore:plankWood>.marked("m"),} as IIngredient[string];
val fnc as IRecipeFunction = function(out, ins, cInfo) {print("~~ recipe function executed");return ins.m;};
val isShapeless = i%2==0;
val item = output | <minecraft:potion>.withTag({Potion: "minecraft:leaping"});
val adsCount = 3;
val ext = Extension(function (
output as crafttweaker.item.IItemStack,
recipeName as string,
grid as Grid,
recipeFunction as crafttweaker.recipes.IRecipeFunction,
recipeAction as crafttweaker.recipes.IRecipeAction,
isShapeless as bool
) as bool {print("~~ test extension checked"); return false;});
val grid = Grid(gridStr, options);
#------------------------------------------------------------------
# Methods
#------------------------------------------------------------------
craft. shapeless(output, gridLine, options);
craft. shapeless(output, gridLine, options, fnc);
craft. shaped(output, gridStr, options);
craft. shaped(output, gridStr, options, fnc);
craft. make(output, gridStr, options);
craft. make(output, gridStr, options, fnc);
craft. make(output, gridStr, options, fnc, isShapeless);
craft. reshapeless(output, gridLine, options);
craft. reshapeless(output, gridLine, options, fnc);
craft. reshaped(output, gridStr, options);
craft. reshaped(output, gridStr, options, fnc);
craft. remake(output, gridStr, options);
craft. remake(output, gridStr, options, fnc);
craft. remake(output, gridStr, options, fnc, isShapeless);
print(craft. itemName(item));
print(craft. itemCount(item));
print(craft. itemSerialize(item));
print(craft. recipeName(output, gridStr, options));
print(craft. recipeName(output, grid));
print(craft. recipeName(item, output, adsCount));
print(craft. uniqueRecipeName(output, grid));
craft. pushExtension(ext);
#------------------------------------------------------------------
# Grid
#------------------------------------------------------------------
val style as string[] = [];
val c = "opt";
print(serialize.IIngredient____(grid.shaped()));
print(serialize.IIngredient__(grid.shapeless()));
print(serialize.IIngredient(grid.getMainIngredient()));
print(grid.toString());
print(grid.toString(style));
print(grid.hasOpt(c));
print(grid.get(i+1, i*2));
print(grid.getRaw(i+1, i*2));
print(grid.getRaw(i+1, i*2, {a:false,A:true}));
print(grid.isMapEmpty());
}
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
print("~~~ End Of Tests");
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");