Skip to content

Commit

Permalink
Fixed some critical issues, mostly regarding models and its file stru…
Browse files Browse the repository at this point in the history
…cture, as well as making some tweaks
  • Loading branch information
Deviouslrd committed Jan 16, 2021
1 parent c9a3032 commit 0f07654
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 47 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
test.json
Minecraft JSON Generator-win32-x64
Minecraft JSON Generator-win32-x64.zip
builds
Git Image.png
icon.png
Binary file added assets/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 31 additions & 31 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}\\model`)) {
fs.mkdir(`${filepath}\\model`, (err) => {
if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

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

fs.writeFile(`${filepath}\\model\\block\\${blockName}.json`, jsonContent, 'utf8', (err) => {
fs.writeFile(`${filepath}\\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}\\model`)) {
fs.mkdir(`${filepath}\\model`, (err) => {
if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

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

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

});

fs.writeFile(`${filepath}\\model\\block\\${blockName}_slab_top.json`, jsonContent2, 'utf8', (err) => {
fs.writeFile(`${filepath}\\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}\\model`)) {
fs.mkdir(`${filepath}\\model`, (err) => {
if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

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

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

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

fs.writeFile(`${filepath}\\model\\block\\${blockName}_stairs_outer.json`, jsonContent3, 'utf8', (err) => {
fs.writeFile(`${filepath}\\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}\\model`)) {
fs.mkdir(`${filepath}\\model`, (err) => {
if (!fs.existsSync(`${filepath}\\models`)) {
fs.mkdir(`${filepath}\\models`, (err) => {
if (err) throw err;
console.log('Made the model folder.');
});
}

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

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

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

fs.writeFile(`${filepath}\\model\\block\\${blockName}_wall_side_tall.json`, jsonContent3, 'utf8', (err) => {
fs.writeFile(`${filepath}\\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 @@ -266,26 +266,26 @@ document.getElementById("blockModelForm").onsubmit = form => {
const jsonContent1 = JSON.stringify(jsonProduct1, null, 4);
const jsonContent2 = JSON.stringify(jsonProduct2, null, 4);

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

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

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

fs.writeFile(`${filepath}\\model\\block\\${blockName}_pillar_horizontal.json`, jsonContent2, 'utf8', (err) => {
fs.writeFile(`${filepath}\\models\\block\\${blockName}_pillar_horizontal.json`, jsonContent2, 'utf8', (err) => {
if (err) throw err;
console.log('Made pillar horizontal file.');
});
Expand Down
22 changes: 11 additions & 11 deletions functions/item_models.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ document.getElementById("itemModelForm").onsubmit = form => {

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

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

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion functions/recipes.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ document.getElementById("recipeForm").onsubmit = form => {
document.getElementById("generateBtn").value ="Generate!";
}, 1000);
}
}
};
Binary file added icon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "main.js",
"scripts": {
"start": "electron .",
"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"
"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"
},
"devDependencies": {
"electron": "^11.1.1",
Expand Down
10 changes: 9 additions & 1 deletion pages/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ <h1 class="header1">Minecraft Mod JSON Creation Tool</h1>
</div>
</div>
<a class="buttondisabled" style="background-color: darkgrey;color:grey" href="./test.html">Testing</a>
</div>
</div><br>
<label class="textbold" style="font-size: 20px; vertical-align: 10px;">Github Link:</label>
<input type="image" src="../assets/github.png" onclick="gitLink()" alt="https://github.com/Deviouslrd/json-generator">

<script>
function gitLink () {
require("electron").shell.openExternal("https://github.com/Deviouslrd/json-generator");
}
</script>
</body>
</html>

0 comments on commit 0f07654

Please sign in to comment.