diff --git a/dist/js/scripts.js b/dist/js/scripts.js index 95db364..fb5176d 100644 --- a/dist/js/scripts.js +++ b/dist/js/scripts.js @@ -5,6 +5,7 @@ $(document).ready(function () { const form = $("#calculatorForm"); const formOptions = $("#formItems"); + const fileName = $("#filename"); const item = $("#item"); const itemCount = $("#itemcount"); @@ -104,16 +105,24 @@ $(document).ready(function () { }); item.change(function () { - //If value is not empty, show other options ... + // If value is not empty, show other options ... if (this.value !== "") { formOptions.show(); + //... and set filename (in tag) + fileName.text(this.value + ".json"); + //... and set max value of item count. const max = itemDamages[this.value]; itemCount.prop('max', max); plus.prop('disabled', false); - } else { //Or if empty, hide other options. + } else { + // Or if empty, hide other options ... formOptions.hide(); + output.text("Fill in the form above to get an output."); + + //... and reset filename + fileName.text("file"); } }); diff --git a/dist/js/scripts.min.js b/dist/js/scripts.min.js index 7c94a75..f1271e8 100644 --- a/dist/js/scripts.min.js +++ b/dist/js/scripts.min.js @@ -1 +1 @@ -let namespace="vp";$(document).ready(function(){const $cmd=$("#custommodeldata");const form=$("#calculatorForm");const formOptions=$("#formItems");const item=$("#item");const itemCount=$("#itemcount");const items=$("#items");const output=$("#content");const copyButton=$("#copyButton");const downloadButton=$("#downloadButton");const minus=$("#minus");const plus=$("#plus");const input=$("input[name='quant']");const nsp=$("#namespace");const $select=$("#item");minus.click(function(){const currentVal=parseInt(input.attr("value"));if(!isNaN(currentVal)){if(currentVal>input.attr("min")){input.attr("value",(currentVal-1).toString())}if(currentVal-1===input.attr("min")){$(this).attr("disabled",true)}$("#iteminput"+currentVal).remove()}else{input.attr("value","0")}});plus.click(function(){const currentVal=parseInt(input.attr("value"));if(!isNaN(currentVal)){if(currentVal1){minus.prop("disabled",false)}else{minus.prop("disabled",true)}items.append('
'+namespace+':item/
')}else{input.attr("value","0")}});$.each(itemDamages,function(key){const itemName=capitalize(key);$select.append($("").attr("value",key).text(itemName))});$cmd.change(function(){$select.find("option").each(function(){const key=$(this).val();const itemName=capitalize(key);const hasSupportText=$(this).text().includes("(supports");if(key===""){return}if($cmd.is(":checked")){if(hasSupportText){$(this).text(itemName)}}else{if(!hasSupportText){const updatedText=itemName+" (supports "+itemDamages[key]+" models)";$(this).text(updatedText)}}})});nsp.change(function(){namespace=nsp.val();if(!namespace)namespace="minecraft";nsp.val(namespace);$("span[id^='namespace']").text(namespace+":item/")});item.change(function(){if(this.value!==""){formOptions.show();const max=itemDamages[this.value];itemCount.prop("max",max);plus.prop("disabled",false)}else{formOptions.hide()}});form.on("submit",function(e){e.preventDefault();const supportsCMD=$cmd.is(":checked");const selectedItem=item.val();const currentVal=parseInt(input.attr("value"));const models=[];for(let i=0;iword.charAt(0).toUpperCase()+word.slice(1)).join(" ")}function randomModel(){const months=["red_car","blue_car","green_car","orange_car","blue_bicycle","red_bicycle","green_bicycle","orange_bicycle"];return months[Math.floor(Math.random()*months.length)]}}); \ No newline at end of file +let namespace="vp";$(document).ready(function(){const $cmd=$("#custommodeldata");const form=$("#calculatorForm");const formOptions=$("#formItems");const fileName=$("#filename");const item=$("#item");const itemCount=$("#itemcount");const items=$("#items");const output=$("#content");const copyButton=$("#copyButton");const downloadButton=$("#downloadButton");const minus=$("#minus");const plus=$("#plus");const input=$("input[name='quant']");const nsp=$("#namespace");const $select=$("#item");minus.click(function(){const currentVal=parseInt(input.attr("value"));if(!isNaN(currentVal)){if(currentVal>input.attr("min")){input.attr("value",(currentVal-1).toString())}if(currentVal-1===input.attr("min")){$(this).attr("disabled",true)}$("#iteminput"+currentVal).remove()}else{input.attr("value","0")}});plus.click(function(){const currentVal=parseInt(input.attr("value"));if(!isNaN(currentVal)){if(currentVal1){minus.prop("disabled",false)}else{minus.prop("disabled",true)}items.append('
'+namespace+':item/
')}else{input.attr("value","0")}});$.each(itemDamages,function(key){const itemName=capitalize(key);$select.append($("").attr("value",key).text(itemName))});$cmd.change(function(){$select.find("option").each(function(){const key=$(this).val();const itemName=capitalize(key);const hasSupportText=$(this).text().includes("(supports");if(key===""){return}if($cmd.is(":checked")){if(hasSupportText){$(this).text(itemName)}}else{if(!hasSupportText){const updatedText=itemName+" (supports "+itemDamages[key]+" models)";$(this).text(updatedText)}}})});nsp.change(function(){namespace=nsp.val();if(!namespace)namespace="minecraft";nsp.val(namespace);$("span[id^='namespace']").text(namespace+":item/")});item.change(function(){if(this.value!==""){formOptions.show();fileName.text(this.value+".json");const max=itemDamages[this.value];itemCount.prop("max",max);plus.prop("disabled",false)}else{formOptions.hide();output.text("Fill in the form above to get an output.");fileName.text("file")}});form.on("submit",function(e){e.preventDefault();const supportsCMD=$cmd.is(":checked");const selectedItem=item.val();const currentVal=parseInt(input.attr("value"));const models=[];for(let i=0;iword.charAt(0).toUpperCase()+word.slice(1)).join(" ")}function randomModel(){const months=["red_car","blue_car","green_car","orange_car","blue_bicycle","red_bicycle","green_bicycle","orange_bicycle"];return months[Math.floor(Math.random()*months.length)]}}); \ No newline at end of file diff --git a/index.html b/index.html index 30b3f00..d0a48e5 100644 --- a/index.html +++ b/index.html @@ -47,11 +47,11 @@

VehiclesPlus Model File Generator

-

Generate the resourcepack asset files for your VehiclesPlus models.

+

Easily generate the resourcepack asset files for your VehiclesPlus models.


-

You indicate which item you want to use and the path to the models for each - value. This tool then - creates the .json file for you.

+

You can use this tool to generate the model files for your custom VehiclesPlus + models.
+ Easily put the generated files in your resourcepack to use them in-game.

@@ -59,17 +59,17 @@
-
1.14+ supports custom model data, which is preferred by - VehiclesPlus. If you - use 1.13 or lower, the calculator works with damage values. +
For 1.14+, preferably use custom model data. For older + versions, + please disable this option.
-
The example resourcepack places files in the 'vp' - namespace. If - you use the 'minecraft' namespace, change it to minecraft. +
The example resourcepack uses the namespace vp. You + can + change this to your liking.
@@ -77,8 +77,8 @@ -
Select the item you want to use. If you want to support colors, - use a Leather item. +
Select the item you want to use. If you want to use colors, you need + to use a leather armor item.

-
Output JSON:
+
Output file:
Fill in the form above to get an output.
- - Download + Download + +

Place the output in the assets/minecraft/models/item/ folder of your + resourcepack.