Skip to content

Commit

Permalink
General improvements, all the files are now nearly identical, yet sti…
Browse files Browse the repository at this point in the history
…ll perfectly functional
  • Loading branch information
Deviouslrd committed Jan 18, 2021
1 parent f356162 commit 827256f
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 286 deletions.

This file was deleted.

1 change: 1 addition & 0 deletions functions/advancements.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ document.getElementById("advanceForm").onsubmit = form => {
});

document.getElementById("generateBtn").value = "Generated!";
document.getElementById("errorholder").innerHTML = "";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
Expand Down
13 changes: 8 additions & 5 deletions functions/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ document.getElementById("").onsubmit = form => {
console.log('made file');

});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

document.getElementById("generateBtn").value = "Generated!";
document.getElementById("errorholder").innerHTML = "";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);

}, 10);
};
52 changes: 12 additions & 40 deletions functions/block_models.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ document.getElementById("blockModelForm").onsubmit = form => {
localStorage.modName = modName;
localStorage.blockName = blockName;

if (!filepath || localStorage.path === undefined) {
return console.log('No filepath.');
}
if (document.getElementById("saveLocation").value === 'No location') {
return document.getElementById("errorholder").innerHTML = `Error: No save location given!`;
}

blockName = blockName.toLowerCase().split(/ +/).join('_');
modName = modName.toLowerCase().split(/ +/).join('_');
Expand All @@ -29,7 +29,6 @@ document.getElementById("blockModelForm").onsubmit = form => {
setTimeout(() => {
// Block Creator
if (document.getElementById("block").checked === true) {

const jsonProduct = {
parent: `minecraft:block/cube_all`, textures: { all: `${modName}:block/${blockName}`}
};
Expand All @@ -40,17 +39,10 @@ document.getElementById("blockModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made block file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Slab Creator
if (document.getElementById("slab").checked === true) {

const jsonProduct1 = {
parent: `minecraft:block/slab`,
textures: {
Expand All @@ -75,24 +67,16 @@ document.getElementById("blockModelForm").onsubmit = form => {
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}\\assets\\${modName}\\models\\block\\${blockName}_slab_top.json`, jsonContent2, 'utf8', (err) => {
if (err) throw err;
console.log('Made slab_top file.');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Stair Creator
if (document.getElementById("stairs").checked === true) {

const jsonProduct1 = {
parent: "minecraft:block/stairs",
textures: {
Expand Down Expand Up @@ -138,17 +122,10 @@ document.getElementById("blockModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made outer stairs file.');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Wall Creator
if (document.getElementById("wall").checked === true) {

const jsonProduct1 = {
parent: `minecraft:block/template_wall_post`,
textures: {
Expand Down Expand Up @@ -188,17 +165,10 @@ document.getElementById("blockModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made the wall side top file.');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Pillar Creator
if (document.getElementById("pillar").checked === true) {

const jsonProduct1 = {
parent: "minecraft:block/cube_column",
textures: {
Expand Down Expand Up @@ -227,21 +197,23 @@ document.getElementById("blockModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made pillar horizontal file.');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

if (document.getElementById("block").checked === false &&
document.getElementById("slab").checked === false &&
document.getElementById("stairs").checked === false &&
document.getElementById("wall").checked === false &&
document.getElementById("pillar").checked === false) {
document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
return document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
}


document.getElementById("errorholder").innerHTML = "";
document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);

}, 10);
};
41 changes: 8 additions & 33 deletions functions/blockstates.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ document.getElementById("blockstateForm").onsubmit = form => {
setTimeout(() => {
// Block Creator
if (document.getElementById("block").checked === true) {

const jsonProduct = {
variants: { "": { model: `${modName}:block/${blockName}` }}
};
Expand All @@ -39,12 +38,6 @@ document.getElementById("blockstateForm").onsubmit = form => {
if (err) throw err;
console.log('Made file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Slab Creator
Expand All @@ -69,12 +62,6 @@ document.getElementById("blockstateForm").onsubmit = form => {
if (err) throw err;
console.log('Made file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000 );
}

// Stairs Creator
Expand Down Expand Up @@ -169,17 +156,10 @@ document.getElementById("blockstateForm").onsubmit = form => {
if (err) throw err;
console.log('Made file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000 );
}

// Wall Creator
if (document.getElementById("wall").checked === true) {

const jsonProduct = {
"multipart": [
{ when: { up: true }, apply: { model: `${modName}:block/${blockName}_wall_post` } },
Expand Down Expand Up @@ -208,12 +188,6 @@ document.getElementById("blockstateForm").onsubmit = form => {
if (err) throw err;
console.log('Made file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Pillar creator
Expand Down Expand Up @@ -241,21 +215,22 @@ document.getElementById("blockstateForm").onsubmit = form => {
if (err) throw err;
console.log('Made file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000 );
}

if (document.getElementById("block").checked === false &&
document.getElementById("slab").checked === false &&
document.getElementById("stairs").checked === false &&
document.getElementById("wall").checked === false &&
document.getElementById("pillar").checked === false) {
document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
return document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
}

document.getElementById("generateBtn").value = "Generated!";
document.getElementById("errorholder").innerHTML = "";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);

}, 10);
};
39 changes: 8 additions & 31 deletions functions/item_models.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ document.getElementById("itemModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made the block file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Slab Creator
Expand All @@ -58,12 +52,6 @@ document.getElementById("itemModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made the slab file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Stairs Creator
Expand All @@ -78,12 +66,6 @@ document.getElementById("itemModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made the stairs file.');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Pillar Creator
Expand All @@ -98,12 +80,6 @@ document.getElementById("itemModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made the pillar file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}

// Wall Creator
Expand All @@ -119,21 +95,22 @@ document.getElementById("itemModelForm").onsubmit = form => {
if (err) throw err;
console.log('Made the wall file');
});

document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000 );
}

if (document.getElementById("block").checked === false &&
document.getElementById("slab").checked === false &&
document.getElementById("stairs").checked === false &&
document.getElementById("wall").checked === false &&
document.getElementById("pillar").checked === false) {
document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
return document.getElementById("errorholder").innerHTML = "Error: No boxes were selected!";
}

document.getElementById("errorholder").innerHTML = "";
document.getElementById("generateBtn").value = "Generated!";

setTimeout(() => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000 );

}, 10);
};
Loading

0 comments on commit 827256f

Please sign in to comment.