Skip to content

Commit 33bc4ec

Browse files
committed
1.4 release is ready. Added furnace recipes, report all bugs. Added the bricks selector thingy to turn it into brick to all js files.
1 parent cea2be9 commit 33bc4ec

File tree

13 files changed

+157
-9
lines changed

13 files changed

+157
-9
lines changed

functions/advancements.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,18 @@ document.getElementById("advanceForm").onsubmit = form => {
1717
var modName = document.getElementById("modName").value;
1818

1919
localStorage.blockName = blockName;
20+
localStorage.modName = modName;
2021

2122
blockName = blockName.toLowerCase().split(/ +/).join('_');
2223

24+
const blockLength = blockName.length;
25+
const blockLengthStart = blockLength - 6;
26+
const blockSubStr = blockName.substring(blockLengthStart);
27+
28+
if (blockSubStr === 'bricks') {
29+
var finalBlock = blockName.substring(0, blockName.length - 1);
30+
}
31+
2332
const jsonProduct = {
2433
parent: `minecraft:recipes/root`,
2534
rewards: {

functions/base.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ document.getElementById("").onsubmit = form => {
1818
blockName = blockName.toLowerCase().split(/ +/).join('_');
1919
modName = modName.toLowerCase().split(/ +/).join('_');
2020

21+
const blockLength = blockName.length;
22+
const blockLengthStart = blockLength - 6;
23+
const blockSubStr = blockName.substring(blockLengthStart);
24+
25+
if (blockSubStr === 'bricks') {
26+
var finalBlock = blockName.substring(0, blockName.length - 1);
27+
}
28+
2129
if (!fs.existsSync(`${filepath}\\`)) {
2230
fs.mkdir(`${filepath}\\`, { recursive: true}, (err) => {
2331
if (err) throw err;

functions/block_models.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ document.getElementById("blockModelForm").onsubmit = form => {
99
var textureNamespace;
1010
var blockName = document.getElementById("blockName").value;
1111
var modName = document.getElementById("modName").value;
12+
1213
if (document.getElementById("textureNamespace").value === ``) {
1314
textureNamespace = document.getElementById("modName").value;
1415
} else {
@@ -28,6 +29,13 @@ document.getElementById("blockModelForm").onsubmit = form => {
2829
modName = modName.toLowerCase().split(/ +/).join('_');
2930
textureNamespace = textureNamespace.toLowerCase().split(/ +/).join('_');
3031

32+
const blockLength = blockName.length;
33+
const blockLengthStart = blockLength - 6;
34+
const blockSubStr = blockName.substring(blockLengthStart);
35+
36+
if (blockSubStr === 'bricks') {
37+
blockName = blockName.substring(0, blockName.length - 1);
38+
}
3139

3240
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models\\block`)) {
3341
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\block`, {recursive: true}, (err) => {

functions/blockstates.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ document.getElementById("blockstateForm").onsubmit = form => {
2828
blockName = blockName.toLowerCase().split(/ +/).join('_'); // Turns the input into minecraft's block id format
2929
modName = modName.toLowerCase().split(/ +/).join('_'); // Turns the mod into mincraft's block id format
3030

31+
const blockLength = blockName.length;
32+
const blockLengthStart = blockLength - 6;
33+
const blockSubStr = blockName.substring(blockLengthStart);
34+
35+
if (blockSubStr === 'bricks') {
36+
var finalBlock = blockName.substring(0, blockName.length - 1);
37+
}
38+
3139
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\blockstates`)) {
3240
fs.mkdir(`${filepath}\\assets\\${modName}\\blockstates`, { recursive: true}, (err) => {
3341
if (err) throw err;

functions/item_models.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ document.getElementById("itemModelForm").onsubmit = form => {
2727
modName = modName.toLowerCase().split(/ +/).join('_');
2828
textureNamespace = textureNamespace.toLowerCase().split(/ +/).join('_');
2929

30+
const blockLength = blockName.length;
31+
const blockLengthStart = blockLength - 6;
32+
const blockSubStr = blockName.substring(blockLengthStart);
33+
34+
if (blockSubStr === 'bricks') {
35+
var finalBlock = blockName.substring(0, blockName.length - 1);
36+
}
37+
3038
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models\\item`)) {
3139
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\item`, {recursive: true}, (err) => {
3240
if (err) throw err;

functions/loot_tables.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ document.getElementById("lootTableForm").onsubmit = form => {
1818
blockName = blockName.toLowerCase().split(/ +/).join('_');
1919
modName = modName.toLowerCase().split(/ +/).join('_');
2020

21+
const blockLength = blockName.length;
22+
const blockLengthStart = blockLength - 6;
23+
const blockSubStr = blockName.substring(blockLengthStart);
24+
25+
if (blockSubStr === 'bricks') {
26+
var finalBlock = blockName.substring(0, blockName.length - 1);
27+
}
28+
2129
if (!fs.existsSync(`${filepath}\\data\\${modName}\\loot_tables\\blocks`)) {
2230
fs.mkdir(`${filepath}\\data\\${modName}\\loot_tables\\blocks`, { recursive: true }, (err) => {
2331
if (err) throw err;

functions/recipe_furnace.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const fs = require('fs');
2+
3+
document.getElementById("recipeForm").onsubmit = form => {
4+
form.preventDefault();
5+
6+
const filepath = localStorage.path;
7+
8+
var blockName = document.getElementById("blockName").value;
9+
var modName = document.getElementById("modName").value;
10+
var result = document.getElementById("result").value;
11+
12+
localStorage.modName = modName;
13+
localStorage.blockName = blockName;
14+
localStorage.result = result;
15+
16+
if (document.getElementById("saveLocation").value === 'No Location') {
17+
return document.getElementById("errorholder").innerHTML = `Error: No save location given!`;
18+
}
19+
20+
blockName = blockName.toLowerCase().split(/ +/).join('_');
21+
modName = modName.toLowerCase().split(/ +/).join('_');
22+
result = result.toLowerCase().split(/ +/).join('_');
23+
24+
const blockLength = blockName.length;
25+
const blockLengthStart = blockLength - 6;
26+
const blockSubStr = blockName.substring(blockLengthStart);
27+
28+
if (blockSubStr === 'bricks') {
29+
blockName = blockName.substring(0, blockName.length - 1);
30+
}
31+
32+
if (!fs.existsSync(`${filepath}\\data\\${modName}\\recipes\\`)) {
33+
fs.mkdir(`${filepath}\\data\\${modName}\\recipes\\`, { recursive: true}, (err) => {
34+
if (err) throw err;
35+
console.log('Made the furnace folder structure.');
36+
});
37+
}
38+
39+
setTimeout(() => {
40+
const jsonProduct = {
41+
type: "minecraft:smelting",
42+
ingredient: {
43+
item: `${textureNamespace}:${blockName}`
44+
},
45+
result: `${modName}:${result}`,
46+
experience: 1,
47+
cooking_time: 200
48+
};
49+
50+
const jsonContent = JSON.stringify(jsonProduct, null, 4);
51+
52+
// Note, when writing to a file, include \\assets\\${modName} or \\data\\${modName} to do it correctly
53+
fs.writeFile(`${filepath}\\data\\${modName}\\recipes\\${blockName}_furnace.json`, jsonContent, 'utf8', (err) => {
54+
if (err) throw err;
55+
console.log('made file');
56+
57+
});
58+
59+
document.getElementById("generateBtn").value = "Generated!";
60+
document.getElementById("errorholder").innerHTML = "";
61+
62+
setTimeout(() => {
63+
document.getElementById("generateBtn").value ="Generate!";
64+
}, 1000);
65+
66+
}, 10);
67+
};

functions/recipes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ document.getElementById("recipeForm").onsubmit = form => {
1818
blockName = blockName.toLowerCase().split(/ +/).join('_');
1919
modName = modName.toLowerCase().split(/ +/).join('_');
2020

21+
const blockLength = blockName.length;
22+
const blockLengthStart = blockLength - 6;
23+
const blockSubStr = blockName.substring(blockLengthStart);
24+
25+
if (blockSubStr === 'bricks') {
26+
var finalBlock = blockName.substring(0, blockName.length - 1);
27+
}
28+
2129
if (document.getElementById("").checked === true) {
2230

2331
const jsonProduct = {

functions/save.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ document.getElementById("savebutton").addEventListener('click', async () => {
66
});
77

88
function onLoad() {
9-
if (localStorage.blockName) {
9+
if (localStorage.blockName && document.getElementById("blockName")) {
1010
document.getElementById("blockName").value = localStorage.blockName;
1111
}
1212

13-
if (localStorage.modName) {
13+
if (localStorage.modName && document.getElementById("modName")) {
1414
document.getElementById("modName").value = localStorage.modName;
1515
}
1616

17-
if (localStorage.textureNamespace) {
17+
if (localStorage.textureNamespace && document.getElementById("textureNamespace")) {
1818
document.getElementById("textureNamespace").value = localStorage.textureNamespace;
1919
}
2020

functions/test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const fs = require('fs');
2+
3+
document.getElementById("test").onsubmit = form => {
4+
form.preventDefault();
5+
6+
const filepath = localStorage.path;
7+
8+
var blockName = document.getElementById("blockName").value;
9+
var modName = document.getElementById("modName").value;
10+
11+
localStorage.modName = modName;
12+
localStorage.blockName = blockName;
13+
14+
blockName = blockName.toLowerCase().split(/ +/).join('_');
15+
modName = modName.toLowerCase().split(/ +/).join('_');
16+
17+
const blockLength = blockName.length;
18+
const blockLengthStart = blockLength - 6;
19+
const blockSubStr = blockName.substring(blockLengthStart);
20+
21+
if (blockSubStr === 'bricks') {
22+
var finalBlock = blockName.substring(0, blockName.length - 1);
23+
}
24+
};

0 commit comments

Comments
 (0)