Skip to content

Commit 0f07654

Browse files
committed
Fixed some critical issues, mostly regarding models and its file structure, as well as making some tweaks
1 parent c9a3032 commit 0f07654

File tree

8 files changed

+56
-47
lines changed

8 files changed

+56
-47
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
test.json
3-
Minecraft JSON Generator-win32-x64
4-
Minecraft JSON Generator-win32-x64.zip
3+
builds
4+
Git Image.png
5+
icon.png

assets/github.png

2.27 KB
Loading

functions/block_models.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ document.getElementById("blockModelForm").onsubmit = form => {
2828

2929
const jsonContent = JSON.stringify(jsonProduct, null, 4);
3030

31-
if (!fs.existsSync(`${filepath}\\model`)) {
32-
fs.mkdir(`${filepath}\\model`, (err) => {
31+
if (!fs.existsSync(`${filepath}\\models`)) {
32+
fs.mkdir(`${filepath}\\models`, (err) => {
3333
if (err) throw err;
3434
console.log('Made the model folder.');
3535
});
3636
}
3737

38-
if (!fs.existsSync(`${filepath}\\model\\block`)) {
39-
fs.mkdir(`${filepath}\\model\\block`, (err) => {
38+
if (!fs.existsSync(`${filepath}\\models\\block`)) {
39+
fs.mkdir(`${filepath}\\models\\block`, (err) => {
4040
if (err) throw err;
4141
console.log('Made the model/block/ folder.');
4242
});
4343
}
4444

45-
fs.writeFile(`${filepath}\\model\\block\\${blockName}.json`, jsonContent, 'utf8', (err) => {
45+
fs.writeFile(`${filepath}\\models\\block\\${blockName}.json`, jsonContent, 'utf8', (err) => {
4646
if (err) throw err;
4747
console.log('Made block file');
4848
});
@@ -78,27 +78,27 @@ document.getElementById("blockModelForm").onsubmit = form => {
7878
const jsonContent1 = JSON.stringify(jsonProduct1, null, 4);
7979
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);
8080

81-
if (!fs.existsSync(`${filepath}\\model`)) {
82-
fs.mkdir(`${filepath}\\model`, (err) => {
81+
if (!fs.existsSync(`${filepath}\\models`)) {
82+
fs.mkdir(`${filepath}\\models`, (err) => {
8383
if (err) throw err;
8484
console.log('Made the model folder.');
8585
});
8686
}
8787

88-
if (!fs.existsSync(`${filepath}\\model\\block`)) {
89-
fs.mkdir(`${filepath}\\model\\block`, (err) => {
88+
if (!fs.existsSync(`${filepath}\\models\\block`)) {
89+
fs.mkdir(`${filepath}\\models\\block`, (err) => {
9090
if (err) throw err;
9191
console.log('Made the model/block/ folder.');
9292
});
9393
}
9494

95-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_slab.json`, jsonContent1, 'utf8', (err) => {
95+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_slab.json`, jsonContent1, 'utf8', (err) => {
9696
if (err) throw err;
9797
console.log('Made slab file.');
9898

9999
});
100100

101-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_slab_top.json`, jsonContent2, 'utf8', (err) => {
101+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_slab_top.json`, jsonContent2, 'utf8', (err) => {
102102
if (err) throw err;
103103
console.log('Made slab_top file.');
104104
});
@@ -144,31 +144,31 @@ document.getElementById("blockModelForm").onsubmit = form => {
144144
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);
145145
const jsonContent3 = JSON.stringify(jsonProduct3, null, 4);
146146

147-
if (!fs.existsSync(`${filepath}\\model`)) {
148-
fs.mkdir(`${filepath}\\model`, (err) => {
147+
if (!fs.existsSync(`${filepath}\\models`)) {
148+
fs.mkdir(`${filepath}\\models`, (err) => {
149149
if (err) throw err;
150150
console.log('Made the model folder.');
151151
});
152152
}
153153

154-
if (!fs.existsSync(`${filepath}\\model\\block`)) {
155-
fs.mkdir(`${filepath}\\model\\block`, (err) => {
154+
if (!fs.existsSync(`${filepath}\\models\\block`)) {
155+
fs.mkdir(`${filepath}\\models\\block`, (err) => {
156156
if (err) throw err;
157157
console.log('Made the model/block/ folder.');
158158
});
159159
}
160160

161-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_stairs.json`, jsonContent1, 'utf8', (err) => {
161+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_stairs.json`, jsonContent1, 'utf8', (err) => {
162162
if (err) throw err;
163163
console.log('Made stairs file.');
164164
});
165165

166-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_stairs_inner.json`, jsonContent2, 'utf8', (err) => {
166+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_stairs_inner.json`, jsonContent2, 'utf8', (err) => {
167167
if (err) throw err;
168168
console.log('Made inner stairs file.');
169169
});
170170

171-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_stairs_outer.json`, jsonContent3, 'utf8', (err) => {
171+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_stairs_outer.json`, jsonContent3, 'utf8', (err) => {
172172
if (err) throw err;
173173
console.log('Made outer stairs file.');
174174
});
@@ -208,31 +208,31 @@ document.getElementById("blockModelForm").onsubmit = form => {
208208
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);
209209
const jsonContent3 = JSON.stringify(jsonProduct3, null, 4);
210210

211-
if (!fs.existsSync(`${filepath}\\model`)) {
212-
fs.mkdir(`${filepath}\\model`, (err) => {
211+
if (!fs.existsSync(`${filepath}\\models`)) {
212+
fs.mkdir(`${filepath}\\models`, (err) => {
213213
if (err) throw err;
214214
console.log('Made the model folder.');
215215
});
216216
}
217217

218-
if (!fs.existsSync(`${filepath}\\model\\block`)) {
219-
fs.mkdir(`${filepath}\\model\\block`, (err) => {
218+
if (!fs.existsSync(`${filepath}\\models\\block`)) {
219+
fs.mkdir(`${filepath}\\models\\block`, (err) => {
220220
if (err) throw err;
221221
console.log('Made the model/block/ folder.');
222222
});
223223
}
224224

225-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_wall_post.json`, jsonContent1, 'utf8', (err) => {
225+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_wall_post.json`, jsonContent1, 'utf8', (err) => {
226226
if (err) throw err;
227227
console.log('Made the wall post file.');
228228
});
229229

230-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_wall_side.json`, jsonContent2, 'utf8', (err) => {
230+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_wall_side.json`, jsonContent2, 'utf8', (err) => {
231231
if (err) throw err;
232232
console.log('Made the wall side file.');
233233
});
234234

235-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_wall_side_tall.json`, jsonContent3, 'utf8', (err) => {
235+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_wall_side_tall.json`, jsonContent3, 'utf8', (err) => {
236236
if (err) throw err;
237237
console.log('Made the wall side top file.');
238238
});
@@ -266,26 +266,26 @@ document.getElementById("blockModelForm").onsubmit = form => {
266266
const jsonContent1 = JSON.stringify(jsonProduct1, null, 4);
267267
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);
268268

269-
if (!fs.existsSync(`${filepath}\\model`)) {
270-
fs.mkdir(`${filepath}\\model`, (err) => {
269+
if (!fs.existsSync(`${filepath}\\models`)) {
270+
fs.mkdir(`${filepath}\\models`, (err) => {
271271
if (err) throw err;
272272
console.log('Made the model folder.');
273273
});
274274
}
275275

276-
if (!fs.existsSync(`${filepath}\\model\\block`)) {
277-
fs.mkdir(`${filepath}\\model\\block`, (err) => {
276+
if (!fs.existsSync(`${filepath}\\models\\block`)) {
277+
fs.mkdir(`${filepath}\\models\\block`, (err) => {
278278
if (err) throw err;
279279
console.log('Made the model/block/ folder.');
280280
});
281281
}
282282

283-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_pillar.json`, jsonContent1, 'utf8', (err) => {
283+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_pillar.json`, jsonContent1, 'utf8', (err) => {
284284
if (err) throw err;
285285
console.log('Made pillar file.');
286286
});
287287

288-
fs.writeFile(`${filepath}\\model\\block\\${blockName}_pillar_horizontal.json`, jsonContent2, 'utf8', (err) => {
288+
fs.writeFile(`${filepath}\\models\\block\\${blockName}_pillar_horizontal.json`, jsonContent2, 'utf8', (err) => {
289289
if (err) throw err;
290290
console.log('Made pillar horizontal file.');
291291
});

functions/item_models.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ document.getElementById("itemModelForm").onsubmit = form => {
2727

2828
const jsonContent = JSON.stringify(jsonProduct, null, 4);
2929

30-
if (!fs.existsSync(`${filepath}\\model`)) {
31-
fs.mkdir(`${filepath}\\model`, (err) => {
30+
if (!fs.existsSync(`${filepath}\\models`)) {
31+
fs.mkdir(`${filepath}\\models`, (err) => {
3232
if (err) throw err;
3333
console.log('Made the model folder.');
3434
});
3535
}
3636

37-
if (!fs.existsSync(`${filepath}\\model\\item`)) {
38-
fs.mkdir(`${filepath}\\model\\item`, (err) => {
37+
if (!fs.existsSync(`${filepath}\\models\\item`)) {
38+
fs.mkdir(`${filepath}\\models\\item`, (err) => {
3939
if (err) throw err;
40-
console.log('Made the model/item/ folder.');
40+
console.log('Made the models/item/ folder.');
4141
});
4242
}
4343

44-
fs.writeFile(`${filepath}\\model\\item\\${blockName}.json`, jsonContent, 'utf8', (err) => {
44+
fs.writeFile(`${filepath}\\models\\item\\${blockName}.json`, jsonContent, 'utf8', (err) => {
4545
if (err) throw err;
4646
console.log('made file');
4747

@@ -63,21 +63,21 @@ document.getElementById("itemModelForm").onsubmit = form => {
6363

6464
const jsonContent = JSON.stringify(jsonProduct, null, 4);
6565

66-
if (!fs.existsSync(`${filepath}\\model`)) {
67-
fs.mkdir(`${filepath}\\model`, (err) => {
66+
if (!fs.existsSync(`${filepath}\\models`)) {
67+
fs.mkdir(`${filepath}\\models`, (err) => {
6868
if (err) throw err;
6969
console.log('Made the model folder.');
7070
});
7171
}
7272

73-
if (!fs.existsSync(`${filepath}\\model\\item`)) {
74-
fs.mkdir(`${filepath}\\model\\item`, (err) => {
73+
if (!fs.existsSync(`${filepath}\\models\\item`)) {
74+
fs.mkdir(`${filepath}\\models\\item`, (err) => {
7575
if (err) throw err;
7676
console.log('Made the model/item/ folder.');
7777
});
7878
}
7979

80-
fs.writeFileSync(`${filepath}\\model\\item\\${blockName}.json`, jsonContent, 'utf8', (err) => {
80+
fs.writeFileSync(`${filepath}\\models\\item\\${blockName}.json`, jsonContent, 'utf8', (err) => {
8181
if (err) throw err;
8282
console.log('made file');
8383

functions/recipes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ document.getElementById("recipeForm").onsubmit = form => {
4545
document.getElementById("generateBtn").value ="Generate!";
4646
}, 1000);
4747
}
48-
}
48+
};

icon.ico

100 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"main": "main.js",
77
"scripts": {
88
"start": "electron .",
9-
"build": "electron-packager ./ \"Minecraft JSON Generator\" --executable-name=minecraftjsongenerator --appname=\"Minecraft JSON Generator\" --app-version=1.0 --ignore=/node_modules --ignore=.gitignore --ignore=README.md --ignore=.eslintrc.json"
9+
"build": "electron-packager ./ \"Minecraft JSON Generator\" --executable-name=minecraftjsongenerator --appname=\"Minecraft JSON Generator\" --app-version=1.0 --ignore=/node_modules --ignore=.gitignore --ignore=README.md --ignore=.eslintrc.json --icon=icon.ico"
1010
},
1111
"devDependencies": {
1212
"electron": "^11.1.1",

pages/main.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ <h1 class="header1">Minecraft Mod JSON Creation Tool</h1>
2626
</div>
2727
</div>
2828
<a class="buttondisabled" style="background-color: darkgrey;color:grey" href="./test.html">Testing</a>
29-
</div>
29+
</div><br>
30+
<label class="textbold" style="font-size: 20px; vertical-align: 10px;">Github Link:</label>
31+
<input type="image" src="../assets/github.png" onclick="gitLink()" alt="https://github.com/Deviouslrd/json-generator">
32+
33+
<script>
34+
function gitLink () {
35+
require("electron").shell.openExternal("https://github.com/Deviouslrd/json-generator");
36+
}
37+
</script>
3038
</body>
3139
</html>

0 commit comments

Comments
 (0)