diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..dae0a83 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "MinifyAll.PrefixOfNewMinifiedFiles": ".min", + "MinifyAll.minifyOnSaveToNewFile": true, + "MinifyAll.disableJson": true, + "MinifyAll.disableHtml": true, + "MinifyAll.openMinifiedDocument": false, +} \ No newline at end of file diff --git a/dist/css/beautify.min.css b/dist/css/beautify.min.css index 7ca5ed6..6d09dc7 100644 --- a/dist/css/beautify.min.css +++ b/dist/css/beautify.min.css @@ -1 +1 @@ -pre{outline:1px solid #ccc;padding:5px;margin:5px}.string{color:green}.number{color:#ff8c00}.boolean{color:#00f}.null{color:#ff00ff}.key{color:red} \ No newline at end of file +pre{outline:1px solid #ccc;padding:5px;margin:5px;}.string{color:green;}.number{color:darkorange;}.boolean{color:blue;}.null{color:magenta;}.key{color:red;} \ No newline at end of file diff --git a/dist/js/beautify.min.js b/dist/js/beautify.min.js index 5afd15d..e6882d7 100644 --- a/dist/js/beautify.min.js +++ b/dist/js/beautify.min.js @@ -1 +1 @@ -function syntaxHighlight(e){return"string"!=typeof e&&(e=JSON.stringify(e,void 0,4)),e=e.replace(/&/g,"&").replace(//g,">"),e.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function(e){let t="number";return/^"/.test(e)?t=/:$/.test(e)?"key":"string":/true|false/.test(e)?t="boolean":/null/.test(e)&&(t="null"),''+e+""})} \ No newline at end of file +function syntaxHighlight(e){return"string"!=typeof e&&(e=JSON.stringify(e,void 0,4)),(e=e.replace(/&/g,"&").replace(//g,">")).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(function(e){let t="number";return/^"/.test(e)?t=/:$/.test(e)?"key":"string":/true|false/.test(e)?t="boolean":/null/.test(e)&&(t="null"),''+e+""}))} \ No newline at end of file diff --git a/dist/js/calculator.js b/dist/js/calculator.js index e65793b..4911c10 100644 --- a/dist/js/calculator.js +++ b/dist/js/calculator.js @@ -1,6 +1,11 @@ +// Damage values for items +// Can be found at: https://minecraft.fandom.com/wiki/ const itemDamages = { - 'leather_boots': 64, - 'netherite_hoe': 2030 + 'leather_helmet': 55, // Called a cap for new versions of the game + 'leather_chestplate': 80, + 'leather_leggings': 75, + 'leather_boots': 65, + 'netherite_hoe': 2031 }; /** @@ -33,7 +38,7 @@ function buildJSON(item, models) { for (let i = 0; i < models.length; i++) { const model = models[i]; - const damage = (i + 1) / itemDamages[item]; + const damage = (i + 1) / (itemDamages[item]-1); json['overrides'][i + 1] = { 'predicate': { diff --git a/dist/js/calculator.min.js b/dist/js/calculator.min.js index e6b6006..7840a8f 100644 --- a/dist/js/calculator.min.js +++ b/dist/js/calculator.min.js @@ -1 +1 @@ -function buildJSON(e,t){const a={parent:"item/handheld"};a.textures={layer0:"item/"+e},a.overrides=[],a.overrides[0]={predicate:{damaged:0,damage:0},model:"item/"+e};for(let d=0;d').attr('value', key).text(itemName)); + }); + minus.click(function (e) { const currentVal = parseInt(input.attr('value')); @@ -103,6 +111,16 @@ $(document).ready(function () { navigator.clipboard.writeText(output.text()); }); + /** + * Capitalize a string. + * + * @param {string} str A string to capitalize + * @returns + */ + function capitalize(str) { + return str.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' '); + } + /** * Get a random model. * diff --git a/dist/js/scripts.min.js b/dist/js/scripts.min.js index f672160..3061925 100644 --- a/dist/js/scripts.min.js +++ b/dist/js/scripts.min.js @@ -1 +1 @@ -$(document).ready(function(){function t(){const t=["red_car","blue_car","green_car","orange_car","blue_bicycle","red_bicycle","green_bicycle","orange_bicycle"];return t[Math.floor(Math.random()*t.length)]}const e=$("#calculatorForm"),a=$("#formItems"),n=$("#item"),r=$("#itemcount"),i=$("#items"),o=$("#content"),l=$("#copyButton"),c=$("#downloadButton"),s=$("#minus"),u=$("#plus"),d=$("input[name='quant']");s.click(function(t){const e=parseInt(d.attr("value"));isNaN(e)?d.attr("value","0"):(e>d.attr("min")&&d.attr("value",(e-1).toString()),e-1==d.attr("min")&&$(this).attr("disabled",!0),$("#iteminput"+e).remove())}),u.click(function(e){const a=parseInt(d.attr("value"));if(isNaN(a))d.attr("value","0");else{if(a1?s.prop("disabled",!1):s.prop("disabled",!0),i.append('
')}}),n.change(function(){if(""!==this.value){a.show();const t=itemDamages[this.value];r.prop("max",t),u.prop("disabled",!1)}else a.hide()}),e.on("submit",function(t){t.preventDefault();const e=n.val(),a=parseInt(d.attr("value")),r=[];for(let t=0;tt.charAt(0).toUpperCase()+t.slice(1))).join(" ");d.append($("").attr("value",t).text(a))})),c.click((function(t){const e=parseInt(u.attr("value"));isNaN(e)?u.attr("value","0"):(e>u.attr("min")&&u.attr("value",(e-1).toString()),e-1==u.attr("min")&&$(this).attr("disabled",!0),$("#iteminput"+e).remove())})),s.click((function(t){const e=parseInt(u.attr("value"));if(isNaN(e))u.attr("value","0");else{if(e1?c.prop("disabled",!1):c.prop("disabled",!0),i.append('
')}})),a.change((function(){if(""!==this.value){e.show();const t=itemDamages[this.value];n.prop("max",t),s.prop("disabled",!1)}else e.hide()})),t.on("submit",(function(t){t.preventDefault();const e=a.val(),n=parseInt(u.attr("value")),i=[];for(let t=0;tThe item to use: