-
Notifications
You must be signed in to change notification settings - Fork 3
/
GenBlockJson.lua
150 lines (124 loc) · 4.98 KB
/
GenBlockJson.lua
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
local outFile = nil;
local modName = "adven_one";
local blockName = "grid_normal";
local function GenModelBlockItem()
local path = string.format("src\\main\\resources\\assets\\%s\\models\\item\\%s.json", modName, blockName);
outFile = io.open(path,"w");
outFile:write('{\n');
local content = string.format("\t\"parent\": \"%s:block/%s\"\n", modName,blockName );
outFile:write(content);
outFile:write('}\n');
outFile:close();
end
local function GenModelBlock()
local path = string.format("src\\main\\resources\\assets\\%s\\models\\block\\%s.json", modName, blockName);
outFile = io.open(path,"w");
outFile:write('{\n');
outFile:write('\t\"parent\": \"block/cube_all\",\n');
outFile:write('\t\"textures\": {\n');
local content = string.format("\t\t\"all\": \"%s:blocks/%s\"\n", modName,blockName );
outFile:write(content);
outFile:write('\t}\n');
outFile:write('}\n');
outFile:close();
end
local function GenModelBlockColumn()
local path = string.format("src\\main\\resources\\assets\\%s\\models\\block\\%s.json", modName, blockName);
outFile = io.open(path,"w");
local content = string.format('{\n "parent": "block/cube_column",\n "textures": {\n "end": "%s:blocks/%s_top",\n "side": "%s:blocks/%s"\n }\n}\n' , modName,blockName, modName,blockName);
outFile:write(content);
outFile:close();
end
local function GenBlockState()
local path = string.format("src\\main\\resources\\assets\\%s\\blockstates\\%s.json", modName, blockName);
outFile = io.open(path,"w");
outFile:write('{\n');
outFile:write('\t\"variants\": {\n');
local content = string.format("\t\t\"normal\": { \"model\": \"%s:%s\" }\n", modName,blockName );
outFile:write(content);
outFile:write('\t}\n');
outFile:write('}\n');
outFile:close();
end
local function GenBlockStateCol()
local path = string.format("src\\main\\resources\\assets\\%s\\blockstates\\%s.json", modName, blockName);
outFile = io.open(path,"w");
-- outFile:write('{\n');
-- outFile:write('\t\"variants\": {\n');
local content = string.format('{\n "variants": {\n "axis=y": { "model": "%s:%s" },\n "axis=z": { "model": "%s:%s", "x": 90 },\n "axis=x": { "model": "%s:%s", "x": 90, "y": 90 },\n "axis=none": { "model": "%s:%s" }\n }\n}\n', modName,blockName, modName,blockName, modName,blockName, modName,blockName );
outFile:write(content);
-- outFile:write('\t}\n');
-- outFile:write('}\n');
outFile:close();
end
local function GenBlock(_blockName)
blockName = _blockName;
print("Creating:"..blockName)
GenModelBlockItem();
GenModelBlock();
GenBlockState();
end
local function GenBlockCol(_blockName)
blockName = _blockName;
print("Creating:"..blockName)
GenModelBlockItem();
GenModelBlockColumn();
GenBlockStateCol();
end
local function GenItem(_typeName, _itemName)
print("Creating:".._typeName.." ".._itemName)
local path = string.format("src\\main\\resources\\assets\\%s\\models\\item\\%s.json", modName, _itemName);
outFile = io.open(path,"w");
local content = string.format('{"parent": "item/handheld","textures": {"layer0":"%s:items/%s/%s"}}\n', modName, _typeName, _itemName );
outFile:write(content);
outFile:close();
end
local function GenItemTier(_typeName, _itemName, tier)
print("Creating:".._typeName.." ".._itemName)
local path = string.format("src\\main\\resources\\assets\\%s\\models\\item\\%s.json", modName, _itemName);
outFile = io.open(path,"w");
local content = string.format('{"parent": "item/handheld","textures": {"layer0":"%s:items/%s/%s",\n"layer1":"%s:items/overlay_%d"}}\n', modName, _typeName, _itemName, modName, tier );
outFile:write(content);
outFile:close();
end
local function GenSet(_setName)
GenBlock(_setName.."_planks");
GenBlock(_setName.."_dirt");
GenBlock(_setName.."_stone");
GenBlockCol(_setName.."_log");
for i = 1, 4 do
GenItemTier("misc", string.format("%s_%d_%s", _setName, i, "gem"), i);
GenItemTier("misc", string.format("%s_%d_%s", _setName, i, "sword"), i);
GenItemTier("misc", string.format("%s_%d_%s", _setName, i, "pickaxe"), i);
for x = 0, 3 do
GenItemTier("misc", string.format("%s_%d_%s%d", _setName, i, "armor", x), i);
end
GenBlock(string.format("%s_%d_%s", _setName, i, "ore"));
GenBlock(string.format("%s_%d_%s", _setName, i, "block"));
end
end
-- GenItem("misc", "idl_ai_terminal");
-- GenSet("suit_back")
-- GenSet("suit_test")
-- GenSet("suit_celestial")
-- GenSet("suit_luck_a")
GenItem("food", "tp_food");
-- GenItem("food", "food_cost_norm");
-- GenItem("food", "food_cost_big");
-- GenItem("misc", "nano_mender_greater");
-- GenItem("misc", "package_fade_armor_diamond");
-- for i = 1,4 do
-- GenItem("misc", "armor_qsh_"..i);
-- end
-- for i = 1,4 do
-- GenItem("misc", "mor_armor_"..i);
-- end
--GenBlock("builder_farm_sin");
--GenBlock("de_water_orb");
--GenItem("misc", "water_extractor")
--GenItem("misc", "disturb_measure")
--GenItem("skill", "skill_radar_creature")
-- GenItem("skill", "clone_block")
-- for i = 1,4 do
-- GenItem("armor", "l_m_armor_" .. i)
-- end