Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Additions
Browse files Browse the repository at this point in the history
Added a new type of GUI, and optional parents for Blocks and GUIS
  • Loading branch information
Minimine committed May 1, 2018
1 parent e95b216 commit 8c964ba
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Type **minetem** and add your arguments:

* **Minimine** - *Initial work* - [Minimine](https://github.com/MinimineLP)

## Credits

**Some of the methods aren't my idea. So here I want to link persons from that i have some of the ideas:**
- [SimplySarc](https://www.youtube.com/channel/UCI4Ppudb5EGHNpIYQPVpKdw)
- [Halbzwilling](https://www.youtube.com/user/Halbzwilling)

## Built in

* [NodeJS](https://nodejs.org/en/)
Expand Down
Binary file modified guitemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inventorytemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions src/compiler/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function compile(json, dir) {
if(!Number.isInteger(value.id))console.throwException("CompilingError: The id must be a positive number between 1 and 1562");
if(parseInt(value.id)<1 || parseInt(value.id)>1562)console.throwException("CompilingError: The id must be a positive number between 1 and 1562");

if(value.id in data.ids.diamond_hoe) console.throwException("CompilingError: Can't use that id, please try another, it is propably used for another texture.");
if(!value.parent)value.parent = "diamond_hoe";

if(value.id in data.ids[value.parent]) console.throwException("CompilingError: Can't use that id, please try another, it is propably used for another texture.");

if(!value.textures)console.throwException("CompilingError: Can't create a block without a texture");

Expand Down Expand Up @@ -72,13 +74,13 @@ function compile(json, dir) {
.replaceAll(' ','');


var path = dir+`\\assets\\minecraft\\models\\custom\\diamond_hoe\\${value.id}.json`;
var path = dir+`\\assets\\minecraft\\models\\custom\\${value.parent}\\${value.id}.json`;
writeFile(path, json);

// DEBUG:
console.debug(`Compiled block with id ${value.id} into file `+fixBackslash(path));

data.ids.diamond_hoe.push(value.id);
data.ids[value.parent].push(value.id);
});
}
}
Expand Down
21 changes: 13 additions & 8 deletions src/compiler/guis.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,30 @@ function compile(json, dir) {
if(!Number.isInteger(value.id))console.throwException("CompilingError: The id must be a positive number between 1 and 1562");
if(parseInt(value.id)<1 || parseInt(value.id)>1562)console.throwException("CompilingError: The id must be a positive number between 1 and 1562");

if(value.id in data.ids.diamond_shovel) console.throwException("CompilingError: Can't use that id, please try another, it is propably used for another texture.");
if(!value.parent)value.parent = "diamond_shovel";
if(!("inventory" in value))value.inventory = true;

if(value.id in data.ids[value.parent]) console.throwException("CompilingError: Can't use that id, please try another, it is propably used for another texture.");

if(!value.texture)console.throwException("CompilingError: Can't create a gui without a texture");

var json = "";
if(value.inventory == true) json = util.textureFileLayout.inventory;
else json = util.textureFileLayout.gui;

var json = util.textureFileLayout.gui
.replaceAll('%path%', value.texture)
.replaceAll('\n', '')
.replaceAll(' ', '')
.replaceAll(' ','');
json = json.replaceAll('%path%', value.texture)
.replaceAll('\n', '')
.replaceAll(' ', '')
.replaceAll(' ','');


var path = dir+`\\assets\\minecraft\\models\\custom\\diamond_shovel\\${value.id}.json`;
var path = dir+`\\assets\\minecraft\\models\\custom\\${value.parent}\\${value.id}.json`;
writeFile(path, json);

// DEBUG:
console.debug(`Compiled gui with id ${value.id} into file `+fixBackslash(path));

data.ids.diamond_shovel.push(value.id);
data.ids[value.parent].push(value.id);
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const textureFileLayout = {
display: `"display": {"head": {"rotation": [-30, 0, 0],"translation": [ 0, -18.4825, -14.29 ],"scale": [ 1.9845, 1.9845, 1.9845 ]}}`,
elements: `"elements":[{"from":[-16,-16,-16],"to":[32,32,32],"faces":{"up":{"texture":"#up","uv":[0,0,16,16]},"down":{"texture":"#down","uv":[0,0,16,16]},"west":{"texture":"#west","uv":[0,0,16,16]},"east":{"texture":"#east","uv":[0,0,16,16]},"north":{"texture":"#north","uv":[0,0,16,16]},"south":{"texture":"#south","uv":[0,0,16,16]}}}]`,
onelayer: `{"__createdwith": "Minetem Compiler","parent": "item/generated","textures": {"layer0": "%path%"}}}`,
gui: `{"__createdwith": "Minetem Compiler","textures":{"texture":"%path%"},"elements":[{"from":[-16,-16,15.9375],"to":[32,32,16],"faces":{"north":{"uv":[0,0,16,16],"rotation":180,"texture":"#texture"},"south":{"uv":[0,0,16,16],"texture":"#texture"}}}],"display":{"firstperson_lefthand":{"rotation":[0,0,0],"translation":[0,0,0],"scale":[0,0,0]},"gui":{"rotation":[0,0,0],"translation":[72,-62,-80],"scale":[3.66,3.66,3.66]}}}`,
inventory: `{"__createdwith": "Minetem Compiler","textures":{"texture":"%path%"},"elements":[{"from":[-16,-16,15.9375],"to":[32,32,16],"faces":{"north":{"uv":[0,0,16,16],"rotation":180,"texture":"#texture"},"south":{"uv":[0,0,16,16],"texture":"#texture"}}}],"display":{"firstperson_lefthand":{"scale":[0,0,0]},"gui":{"translation":[72,-62,-80],"scale":[3.66,3.66,3.66]}}}`,
gui: `{"__createdwith": "Minetem Compiler","textures":{"texture":"%path%"},"elements":[{"from":[-16,-16,15.9375],"to":[32,32,16],"faces":{"north":{"uv":[0,0,16,16],"rotation":180,"texture":"#texture"},"south":{"uv":[0,0,16,16],"texture":"#texture"}}}],"display":{"firstperson_lefthand":{"translation":[-9,3.1,0],"scale":[0.45,0.45,0.45]},"firstperson_righthand":{"translation":[-9,3.1,0],"scale":[0.45,0.45,0.45]}, "thirdperson_righthand":{"scale":[0,0,0]},"thirdperson_lefthand":{"scale":[0,0,0]},"gui":{"translation":[72,-62,-80],"scale":[0,0,0]}}}`,
}

const damage = {
Expand Down

0 comments on commit 8c964ba

Please sign in to comment.