Fixed minor issue in calculator
Some checks are pending
Validate HTML site / build (push) Waiting to run
Some checks are pending
Validate HTML site / build (push) Waiting to run
This commit is contained in:
parent
d49f3dec2d
commit
4d1a6e7ea2
2 changed files with 5 additions and 8 deletions
11
dist/js/calculator.js
vendored
11
dist/js/calculator.js
vendored
|
@ -46,7 +46,7 @@ function buildJSON(supportsCMD, item, namespace, models) {
|
|||
};
|
||||
}
|
||||
} else {
|
||||
//Insert not damaged item
|
||||
//Insert not damaged item (in default namespace)
|
||||
json['overrides'][0] = {
|
||||
'predicate': {
|
||||
'damaged': 0,
|
||||
|
@ -57,19 +57,16 @@ function buildJSON(supportsCMD, item, namespace, models) {
|
|||
|
||||
//Insert damaged models
|
||||
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
|
||||
'damage': (i + 1) / (itemDamages[item] - 1)
|
||||
},
|
||||
'model': namespace + model
|
||||
'model': namespace + 'item/' + models[i]
|
||||
};
|
||||
}
|
||||
|
||||
//Insert fully damaged item
|
||||
//Insert fully damaged item (in default namespace)
|
||||
json['overrides'][models.length + 1] = {
|
||||
'predicate': {
|
||||
'damaged': 1,
|
||||
|
|
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++){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)}
|
||||
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)}
|
Reference in a new issue