Limited damage to 6 decimals
Some checks failed
Validate HTML site / build (push) Has been cancelled
Some checks failed
Validate HTML site / build (push) Has been cancelled
This commit is contained in:
parent
4d1a6e7ea2
commit
146c19211c
2 changed files with 2 additions and 2 deletions
2
dist/js/calculator.js
vendored
2
dist/js/calculator.js
vendored
|
@ -60,7 +60,7 @@ function buildJSON(supportsCMD, item, namespace, models) {
|
||||||
json['overrides'][i + 1] = {
|
json['overrides'][i + 1] = {
|
||||||
'predicate': {
|
'predicate': {
|
||||||
'damaged': 0,
|
'damaged': 0,
|
||||||
'damage': (i + 1) / (itemDamages[item] - 1)
|
'damage': ((i + 1) / (itemDamages[item] - 1)).toFixed(6)
|
||||||
},
|
},
|
||||||
'model': namespace + 'item/' + models[i]
|
'model': namespace + 'item/' + models[i]
|
||||||
};
|
};
|
||||||
|
|
2
dist/js/calculator.min.js
vendored
2
dist/js/calculator.min.js
vendored
|
@ -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)}
|
Reference in a new issue