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
SBDeveloper 4d1a6e7ea2
Some checks are pending
Validate HTML site / build (push) Waiting to run
Fixed minor issue in calculator
2024-04-15 19:41:44 +02:00

1 line
No EOL
894 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++){json["overrides"][i+1]={predicate:{damaged:0,damage:(i+1)/(itemDamages[item]-1)},model:namespace+"item/"+models[i]}}json["overrides"][models.length+1]={predicate:{damaged:1,damage:0},model:"item/"+item}}return JSON.stringify(json,null,2)}