Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions functions/advancements.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ document.getElementById("advanceForm").onsubmit = form => {
}

var blockName = document.getElementById("blockName").value;
var modName = document.getElementById("modName").value;

localStorage.blockName = blockName;

Expand All @@ -23,18 +24,19 @@ document.getElementById("advanceForm").onsubmit = form => {
parent: `minecraft:recipes/root`,
rewards: {
recipes: [
"ModName:BlockName_slab",
"ModName:BlockName_stairs",
"ModName:BlockName_wall"
`${modName}:${blockName}_slab`,
`${modName}:${blockName}_stairs`,
`${modName}:${blockName}_pillar`,
`${modName}:${blockName}_wall`
]
},
criteria: {
has_stone: {
has_item: {
trigger: `minecraft:inventory_changed`,
conditions: {
items: [
{
item: "ModName:BlockName"
item: `${modName}:${blockName}`
}
]
}
Expand All @@ -44,16 +46,16 @@ document.getElementById("advanceForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\advancements`)) {
fs.mkdir(`${filepath}\\advancements`, (err) => {
if (!fs.existsSync(`${filepath}\\data\\${modName}\\advancements`)) {
fs.mkdir(`${filepath}\\data\\${modName}\\advancements`, { recursive: true }, (err) => {
if (err) throw err;
console.log('Made the advancements folder.');
});
}

fs.writeFile(`${filepath}\\advancements\\${blockName}.json`, jsonContent, 'utf8', (err) => {
fs.writeFile(`${filepath}\\data\\${modName}\\advancements\\${blockName}.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('made file');
console.log('Made advancement file.');

});

Expand All @@ -63,4 +65,4 @@ document.getElementById("advanceForm").onsubmit = form => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);

};
};
4 changes: 3 additions & 1 deletion functions/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ document.getElementById("").onsubmit = form => {

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

// Note, when writing to a file, include \\assets\\${modName} or \\data\\${modName} to do it correctly

if (!fs.existsSync(`${filepath}\\`)) {
fs.mkdir(`${filepath}\\`, (err) => {
if (err) throw err;
Expand All @@ -52,4 +54,4 @@ document.getElementById("").onsubmit = form => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}
}
}
60 changes: 30 additions & 30 deletions functions/block_models.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ document.getElementById("blockModelForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

if (!fs.existsSync(`${filepath}\\models\\block`)) {
fs.mkdir(`${filepath}\\models\\block`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models\\block`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\block`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model/block/ folder.');
});
}

fs.writeFile(`${filepath}\\models\\block\\${blockName}.json`, jsonContent, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('Made block file');
});
Expand Down Expand Up @@ -78,27 +78,27 @@ document.getElementById("blockModelForm").onsubmit = form => {
const jsonContent1 = JSON.stringify(jsonProduct1, null, 4);
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);

if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

if (!fs.existsSync(`${filepath}\\models\\block`)) {
fs.mkdir(`${filepath}\\models\\block`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models\\block`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\block`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model/block/ folder.');
});
}

fs.writeFile(`${filepath}\\models\\block\\${blockName}_slab.json`, jsonContent1, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_slab.json`, jsonContent1, 'utf8', (err) => {
if (err) throw err;
console.log('Made slab file.');

});

fs.writeFile(`${filepath}\\models\\block\\${blockName}_slab_top.json`, jsonContent2, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_slab_top.json`, jsonContent2, 'utf8', (err) => {
if (err) throw err;
console.log('Made slab_top file.');
});
Expand Down Expand Up @@ -144,31 +144,31 @@ document.getElementById("blockModelForm").onsubmit = form => {
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);
const jsonContent3 = JSON.stringify(jsonProduct3, null, 4);

if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

if (!fs.existsSync(`${filepath}\\models\\block`)) {
fs.mkdir(`${filepath}\\models\\block`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models\\block`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\block`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model/block/ folder.');
});
}

fs.writeFile(`${filepath}\\models\\block\\${blockName}_stairs.json`, jsonContent1, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_stairs.json`, jsonContent1, 'utf8', (err) => {
if (err) throw err;
console.log('Made stairs file.');
});

fs.writeFile(`${filepath}\\models\\block\\${blockName}_stairs_inner.json`, jsonContent2, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_stairs_inner.json`, jsonContent2, 'utf8', (err) => {
if (err) throw err;
console.log('Made inner stairs file.');
});

fs.writeFile(`${filepath}\\models\\block\\${blockName}_stairs_outer.json`, jsonContent3, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_stairs_outer.json`, jsonContent3, 'utf8', (err) => {
if (err) throw err;
console.log('Made outer stairs file.');
});
Expand Down Expand Up @@ -208,31 +208,31 @@ document.getElementById("blockModelForm").onsubmit = form => {
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);
const jsonContent3 = JSON.stringify(jsonProduct3, null, 4);

if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

if (!fs.existsSync(`${filepath}\\models\\block`)) {
fs.mkdir(`${filepath}\\models\\block`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\models\\block`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\block`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model/block/ folder.');
});
}

fs.writeFile(`${filepath}\\models\\block\\${blockName}_wall_post.json`, jsonContent1, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_wall_post.json`, jsonContent1, 'utf8', (err) => {
if (err) throw err;
console.log('Made the wall post file.');
});

fs.writeFile(`${filepath}\\models\\block\\${blockName}_wall_side.json`, jsonContent2, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_wall_side.json`, jsonContent2, 'utf8', (err) => {
if (err) throw err;
console.log('Made the wall side file.');
});

fs.writeFile(`${filepath}\\models\\block\\${blockName}_wall_side_tall.json`, jsonContent3, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_wall_side_tall.json`, jsonContent3, 'utf8', (err) => {
if (err) throw err;
console.log('Made the wall side top file.');
});
Expand Down Expand Up @@ -267,25 +267,25 @@ document.getElementById("blockModelForm").onsubmit = form => {
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);

if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
fs.mkdir(`${filepath}\\assets\\${modName}\\models`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

if (!fs.existsSync(`${filepath}\\models\\block`)) {
fs.mkdir(`${filepath}\\models\\block`, (err) => {
fs.mkdir(`${filepath}\\assets\\${modName}\\models\\block`, {recursive: true}, (err) => {
if (err) throw err;
console.log('Made the model/block/ folder.');
});
}

fs.writeFile(`${filepath}\\models\\block\\${blockName}_pillar.json`, jsonContent1, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_pillar.json`, jsonContent1, 'utf8', (err) => {
if (err) throw err;
console.log('Made pillar file.');
});

fs.writeFile(`${filepath}\\models\\block\\${blockName}_pillar_horizontal.json`, jsonContent2, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\models\\block\\${blockName}_pillar_horizontal.json`, jsonContent2, 'utf8', (err) => {
if (err) throw err;
console.log('Made pillar horizontal file.');
});
Expand All @@ -304,4 +304,4 @@ document.getElementById("blockModelForm").onsubmit = form => {
document.getElementById("pillar").checked === false) {
document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
}
};
};
32 changes: 16 additions & 16 deletions functions/blockstates.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ document.getElementById("blockstateForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\blockstates`)) {
fs.mkdir(`${filepath}\\blockstates`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\blockstates`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\blockstates`, {recursive:true}, (err) => {
if (err) throw err;
console.log('Made the blockstate folder.');
});
}

fs.writeFile(`${filepath}\\blockstates\\${blockName}.json`, jsonContent, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\blockstates\\${blockName}.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('Made file');
});
Expand Down Expand Up @@ -64,14 +64,14 @@ document.getElementById("blockstateForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\blockstates`)) {
fs.mkdir(`${filepath}\\blockstates`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\blockstates`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\blockstates`, {recursive:true}, (err) => {
if (err) throw err;
console.log('Made the blockstates folder.');
});
}

fs.writeFileSync(`${filepath}\\blockstates\\${blockName}_slab.json`, jsonContent, 'utf8', (err) => {
fs.writeFileSync(`${filepath}\\assets\\${modName}\\blockstates\\${blockName}_slab.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('Made file');
});
Expand Down Expand Up @@ -171,14 +171,14 @@ document.getElementById("blockstateForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\blockstates`)) {
fs.mkdir(`${filepath}\\blockstates`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\blockstates`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\blockstates`, { recursive:true }, (err) => {
if (err) throw err;
console.log('Made the blockstates folder.');
});
}

fs.writeFileSync(`${filepath}\\blockstates\\${blockName}_slab.json`, jsonContent, 'utf8', (err) => {
fs.writeFileSync(`${filepath}\\assets\\${modName}\\blockstates\\${blockName}_slab.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('Made file');
});
Expand Down Expand Up @@ -217,14 +217,14 @@ document.getElementById("blockstateForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\blockstates`)) {
fs.mkdir(`${filepath}\\blockstates`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\blockstates`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\blockstates`, {recursive:true}, (err) => {
if (err) throw err;
console.log('Made the blockstate folder.');
});
}

fs.writeFile(`${filepath}\\blockstates\\${blockName}_wall.json`, jsonContent, 'utf8', (err) => {
fs.writeFile(`${filepath}\\assets\\${modName}\\blockstates\\${blockName}_wall.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('Made file');
});
Expand Down Expand Up @@ -257,14 +257,14 @@ document.getElementById("blockstateForm").onsubmit = form => {

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

if (!fs.existsSync(`${filepath}\\blockstates`)) {
fs.mkdir(`${filepath}\\blockstates`, (err) => {
if (!fs.existsSync(`${filepath}\\assets\\${modName}\\blockstates`)) {
fs.mkdir(`${filepath}\\assets\\${modName}\\blockstates`, {recursive:true}, (err) => {
if (err) throw err;
console.log('Made the blockstates folder.');
});
}

fs.writeFileSync(`${filepath}\\blockstates\\${blockName}_pillar.json`, jsonContent, 'utf8', (err) => {
fs.writeFileSync(`${filepath}\\assets\\${modName}\\blockstates\\${blockName}_pillar.json`, jsonContent, 'utf8', (err) => {
if (err) throw err;
console.log('Made file');
});
Expand All @@ -275,4 +275,4 @@ document.getElementById("blockstateForm").onsubmit = form => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000 );
}
};
};
Loading