let namespace="vp";const itemDamages={leather_helmet:55,leather_chestplate:80,leather_leggings:75,leather_boots:65,netherite_hoe:2031,diamond_axe:1561,diamond_hoe:1561,shears:238};$(document).ready(function(){const form=$("#resourcePackForm");const version=$("#version");const nsp=$("#namespace");const $select=$("#item");$.each(itemDamages,function(key){const itemName=capitalize(key);$select.append($("").attr("value",key).text(itemName))});$("#resourcepackWant").change(function(){if($("#resourcepackWant").is(":checked")){$("#resourcepack").show();$("#resourcepack-help").show();$("#resourcepackWant-help").hide()}else{$("#resourcepack").hide();$("#resourcepack-help").hide();$("#resourcepackWant-help").show()}});version.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(compareVersions(version.val(),"1.14")<0){if(!hasSupportText){const updatedText=itemName+" (supports "+itemDamages[key]+" models)";$(this).text(updatedText)}}else{if(hasSupportText){$(this).text(itemName)}}})});nsp.change(function(){namespace=nsp.val();if(!namespace)namespace="vp";nsp.val(namespace)});form.on("submit",async function(event){event.preventDefault();const minecraftVersion=$("#version").val();if(!/^1\.(1[2-9]|2[0-1])(\.\d+)?$/.test(minecraftVersion)){alert("Invalid Minecraft version. Please enter a version between 1.12 and 1.21.1.");return}const item=$("#item").val();const formData=new FormData;formData.append("minecraftVersion",minecraftVersion);formData.append("namespace",$("#namespace").val());formData.append("item",item);formData.append("requestId",generateRequestId());if($("#resourcepackWant").is(":checked")){const resourcepackFile=$("#resourcepack")[0].files[0];if(!resourcepackFile){alert("Please select a resource pack file.");return}formData.append("resourcePackZip",resourcepackFile)}const modelsFiles=$("#models")[0].files;for(let i=0;ia[1]-b[1]);for(const[key,value]of sortedBoundItems){const li=$("").html(`${key}
is on ${compareVersions(version.val(),"1.14")<0?"damage":"custom_model_data"}: ${value}
`);$("#outputModels").append(li)}$("#download").attr("href",data.url).attr("download","VehiclesPlusPack.zip");$("#resourcePackOutput").show();form.hide()}else{const errorText=await response.text();alert(errorText)}}catch(error){alert(`Error: ${error.message}`)}});function compareVersions(v1,v2){const v1Parts=v1.split(".").map(Number);const v2Parts=v2.split(".").map(Number);for(let i=0;iv2Part)return 1}return 0}function capitalize(str){return str.split("_").map(word=>word.charAt(0).toUpperCase()+word.slice(1)).join(" ")}function generateRequestId(){return"req_"+Date.now()+"_"+Math.random().toString(36).substring(2,9)}});