This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
VPModelFileTool/dist/js/calculator.min.js

1 line
No EOL
924 B
JavaScript

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};function buildJSON(supportsCMD,item,namespace,models){namespace=namespace==="minecraft"?"":namespace+":";const json={};json["parent"]="item/handheld";json["textures"]={layer0:"item/"+item,layer1:"item/"+item+"_overlay"};json["overrides"]=[];if(supportsCMD){for(let i=0;i<models.length;i++){json["overrides"][i+1]={predicate:{custom_model_data:i+1},model:namespace+"item/"+models[i]}}}else{json["overrides"][0]={predicate:{damaged:0,damage:0},model:"item/"+item};for(let i=0;i<models.length;i++){const model=models[i];const damage=(i+1)/(itemDamages[item]-1);json["overrides"][i+1]={predicate:{damaged:0,damage:damage},model:namespace+model}}json["overrides"][models.length+1]={predicate:{damaged:1,damage:0},model:"item/"+item}}return JSON.stringify(json,null,2)}