Limited damage to 6 decimals
Some checks failed
Validate HTML site / build (push) Has been cancelled

This commit is contained in:
Stijn Bannink 2024-04-15 19:43:01 +02:00
parent 4d1a6e7ea2
commit 146c19211c
Signed by: SBDeveloper
GPG key ID: B730712F2C3A9D7A
2 changed files with 2 additions and 2 deletions

View file

@ -60,7 +60,7 @@ function buildJSON(supportsCMD, item, namespace, models) {
json['overrides'][i + 1] = {
'predicate': {
'damaged': 0,
'damage': (i + 1) / (itemDamages[item] - 1)
'damage': ((i + 1) / (itemDamages[item] - 1)).toFixed(6)
},
'model': namespace + 'item/' + models[i]
};

View file

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