-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
1,391 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import json | ||
import json | ||
|
||
def find_nearest_model(data, durability, damage): | ||
# Assuming the overrides are sorted by damage in ascending order | ||
tolerance = 1e-6 # Set a tolerance value for floating-point comparisons | ||
for override in data['overrides']: | ||
if 'predicate' in override: | ||
if 'damage' in override['predicate'] and abs(override['predicate']['damage'] - damage) < tolerance: | ||
return override['model'] | ||
elif 'custom_model_data' in override['predicate'] and abs(override['predicate']['custom_model_data'] - durability) < tolerance: | ||
return override['model'] | ||
return None # Return the last model if no other is found | ||
|
||
def modify_neck(model_file): | ||
with open(model_file, 'r') as file: | ||
data = json.load(file) | ||
|
||
if 'display' in data and 'thirdperson_lefthand' in data['display']: | ||
translation = data['display']['thirdperson_lefthand']['translation'] | ||
translation[0] -= 1.25 | ||
translation[1] -= 1.75 | ||
translation[2] -= 6.95 | ||
|
||
with open(model_file, 'w') as file: | ||
json.dump(data, file, indent=4) | ||
|
||
def modify_cape(model_file): | ||
with open(model_file, 'r') as file: | ||
data = json.load(file) | ||
|
||
if 'display' in data and 'thirdperson_lefthand' in data['display']: | ||
translation = data['display']['thirdperson_lefthand']['translation'] | ||
translation[1] -= 13 | ||
|
||
with open(model_file, 'w') as file: | ||
json.dump(data, file, indent=4) | ||
|
||
def list_files(input): | ||
with open(input, 'r') as file: | ||
seen_models = set() # Set to store the models that have already been encountered | ||
for line in file: | ||
name, item, durability, damage = line.strip().split(',') | ||
damage = float(damage) | ||
durability = float(durability) | ||
|
||
json_file = f'assets/minecraft/models/item/{item.lower()}.json' | ||
try: | ||
with open(json_file, 'r') as jfile: | ||
data = json.load(jfile) | ||
model = find_nearest_model(data, durability, damage) | ||
if model is None: | ||
print(f'Missing Item: {name} {item} {damage}') | ||
elif model not in seen_models: # Check if the model is not None and has not been encountered | ||
seen_models.add(model) # Add the model to the set of seen models | ||
except FileNotFoundError: | ||
print(f'JSON file for item {item} not found') | ||
return seen_models | ||
|
||
def process_input(): | ||
neck = list_files('run/neck.txt') | ||
for model in neck: | ||
print(f'Neck: {model}') | ||
# Example usage: | ||
model_file = f"assets/ms/models/{model.replace('ms:', '')}.json" | ||
modify_neck(model_file) | ||
neck = list_files('run/neck.txt') | ||
cape = list_files('run/cape.txt') | ||
for model in cape: | ||
print(f'Cape: {model}') | ||
# Example usage: | ||
model_file = f"assets/ms/models/{model.replace('ms:', '')}.json" | ||
#modify_cape(model_file) | ||
|
||
process_input() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Adamant Arrow,DIAMOND_SHOVEL,48,0.030729833546734954 | ||
Adamant Bolts,DIAMOND_SHOVEL,52,0.03329065300896287 | ||
Adamant Javelin,DIAMOND_PICKAXE,1317,0.8431498079385403 | ||
Ancient Blessing,DIAMOND_SWORD,634,0.4058898847631242 | ||
Blurite Bolts,DIAMOND_SHOVEL,609,0.38988476312419973 | ||
Bolt Rack,DIAMOND_SWORD,1290,0.8258642765685019 | ||
Broad Arrows,DIAMOND_PICKAXE,1362,0.8719590268886043 | ||
Broad Bolts,DIAMOND_SWORD,301,0.19270166453265045 | ||
Amethyst Broad Bolts,DIAMOND_HOE,567,0.36299615877080665 | ||
Bronze Arrow,DIAMOND_SHOVEL,699,0.4475032010243278 | ||
Bronze Bolts,DIAMOND_SHOVEL,703,0.4500640204865557 | ||
Bronze Javelin,DIAMOND_PICKAXE,1313,0.8405889884763124 | ||
Dragon Arrow,DIAMOND_HOE,928,0.5941101152368757 | ||
Dragon Bolts,DIAMOND_HOE,926,0.5928297055057619 | ||
Guam Tar,DIAMOND_SWORD,290,0.18565941101152367 | ||
Harralander Tar,DIAMOND_SWORD,291,0.18629961587708066 | ||
Holy Blessing,DIAMOND_SWORD,636,0.40717029449423814 | ||
Honourable Blessing,DIAMOND_SWORD,639,0.40909090909090906 | ||
Iron Arrow,DIAMOND_HOE,394,0.2522407170294494 | ||
Iron Bolts,DIAMOND_HOE,398,0.2548015364916773 | ||
Iron Javelin,DIAMOND_PICKAXE,1314,0.8412291933418694 | ||
Jade Bolts,DIAMOND_HOE,693,0.4436619718309859 | ||
Marrentill Tar,DIAMOND_SWORD,292,0.18693982074263762 | ||
Mith Grapple,DIAMOND_HOE,642,0.41101152368758 | ||
Mithril Arrow,DIAMOND_HOE,751,0.4807938540332906 | ||
Mithril Bolts,DIAMOND_HOE,755,0.4833546734955185 | ||
Mithril Javelin,DIAMOND_PICKAXE,1316,0.8425096030729833 | ||
Onyx Bolts,DIAMOND_PICKAXE,657,0.4206145966709347 | ||
Opal Bolts,DIAMOND_HOE,681,0.43597951344430214 | ||
Peaceful Blessing,DIAMOND_SWORD,638,0.4084507042253521 | ||
Rune Arrow,DIAMOND_HOE,1431,0.9161331626120358 | ||
Amethyst Arrow,DIAMOND_HOE,563,0.36043533930857874 | ||
Rune Javelin,DIAMOND_PICKAXE,1318,0.8437900128040973 | ||
Runite Bolts,DIAMOND_HOE,1534,0.9820742637644045 | ||
Silver Bolts,DIAMOND_PICKAXE,138,0.088348271446863 | ||
Steel Arrow,DIAMOND_PICKAXE,338,0.21638924455825864 | ||
Steel Bolts,DIAMOND_PICKAXE,342,0.21895006402048656 | ||
Steel Javelin,DIAMOND_PICKAXE,1315,0.8418693982074263 | ||
Tarromin Tar,DIAMOND_SWORD,294,0.18822023047375158 | ||
Topaz Bolts,DIAMOND_HOE,707,0.4526248399487836 | ||
Training Arrows,DIAMOND_PICKAXE,593,0.37964148527528807 | ||
Unholy Blessing,DIAMOND_SWORD,637,0.40781049935979513 | ||
War Blessing,DIAMOND_SWORD,635,0.40653008962868115 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
Ahrims Robetop,LEATHER_CHESTPLATE,73,0.9012345679012346 | ||
Ahrims Robetop Degraded,LEATHER_CHESTPLATE,74,0.9135802469135802 | ||
Dharoks Platebody,LEATHER_CHESTPLATE,75,0.9259259259259258 | ||
Dharoks Platebody Degraded,LEATHER_CHESTPLATE,76,0.9382716049382716 | ||
Guthans Platebody,LEATHER_CHESTPLATE,77,0.9506172839506173 | ||
Guthans Platebody Degraded,LEATHER_CHESTPLATE,78,0.9629629629629629 | ||
Karils Leathertop,LEATHER_CHESTPLATE,79,0.9753086419753085 | ||
Karils Leathertop Degraded,LEATHER_CHESTPLATE,80,0.9876543209876543 | ||
Torags Platebody,LEATHER_CHESTPLATE,81,1.0 | ||
Torags Platebody Degraded,LEATHER_CHESTPLATE,82,1.0123456790123457 | ||
Veracs Brassard,LEATHER_CHESTPLATE,83,1.0246913580246912 | ||
Veracs Brassard Degraded,LEATHER_CHESTPLATE,84,1.037037037037037 | ||
Adamant Chainbody,LEATHER_CHESTPLATE,0,0.0 | ||
Adamant Platebody,LEATHER_CHESTPLATE,1,0.012345679012345678 | ||
Adamant Platebody G,LEATHER_CHESTPLATE,32,0.3950617283950617 | ||
Adamant Platebody T,LEATHER_CHESTPLATE,57,0.7037037037037037 | ||
Ancient Platebody,LEATHER_CHESTPLATE,45,0.5555555555555556 | ||
Ancient Robe Top,DIAMOND_HOE,1157,0.7407170294494237 | ||
Armadyl Platebody,LEATHER_CHESTPLATE,44,0.5432098765432098 | ||
Armadyl Robe Top,DIAMOND_HOE,1166,0.7464788732394366 | ||
Bandos Platebody,LEATHER_CHESTPLATE,46,0.5679012345679012 | ||
Bandos Robe Top,DIAMOND_HOE,1168,0.7477592829705505 | ||
Black Chainbody,LEATHER_CHESTPLATE,2,0.024691358024691357 | ||
Black Dhide Body,LEATHER_CHESTPLATE,17,0.20987654320987653 | ||
Black Dhide Body G,LEATHER_CHESTPLATE,36,0.4444444444444444 | ||
Black Dhide Body T,LEATHER_CHESTPLATE,50,0.6172839506172839 | ||
Black Elegant Shirt,DIAMOND_HOE,1170,0.7490396927016645 | ||
Black Platebody,LEATHER_CHESTPLATE,3,0.037037037037037035 | ||
Black Platebody G,LEATHER_CHESTPLATE,30,0.37037037037037035 | ||
Black Platebody T,LEATHER_CHESTPLATE,55,0.6790123456790123 | ||
Black Robe,LEATHER_CHESTPLATE,20,0.24691358024691357 | ||
Black Wizard Robe G,LEATHER_CHESTPLATE,40,0.49382716049382713 | ||
Black Wizard Robe T,LEATHER_CHESTPLATE,63,0.7777777777777777 | ||
Blue Dhide Body,LEATHER_CHESTPLATE,18,0.2222222222222222 | ||
Blue Dhide Body G,LEATHER_CHESTPLATE,35,0.43209876543209874 | ||
Blue Dhide Body T,LEATHER_CHESTPLATE,49,0.6049382716049383 | ||
Blue Elegant Blouse,DIAMOND_HOE,1176,0.7528809218950063 | ||
Blue Elegant Shirt,DIAMOND_HOE,1178,0.7541613316261203 | ||
Blue Wizard Robe,LEATHER_CHESTPLATE,23,0.2839506172839506 | ||
Blue Wizard Robe G,LEATHER_CHESTPLATE,38,0.4691358024691358 | ||
Blue Wizard Robe T,LEATHER_CHESTPLATE,61,0.7530864197530864 | ||
Bobs Black Shirt,DIAMOND_HOE,1180,0.7554417413572343 | ||
Bobs Blue Shirt,DIAMOND_HOE,1181,0.7560819462227912 | ||
Bobs Green Shirt,DIAMOND_HOE,1185,0.7586427656850192 | ||
Bobs Purple Shirt,DIAMOND_HOE,1186,0.7592829705505761 | ||
Bobs Red Shirt,DIAMOND_HOE,1187,0.7599231754161331 | ||
Bronze Chainbody,LEATHER_CHESTPLATE,4,0.04938271604938271 | ||
Bronze Platebody,LEATHER_CHESTPLATE,5,0.06172839506172839 | ||
Bronze Platebody G,LEATHER_CHESTPLATE,27,0.3333333333333333 | ||
Bronze Platebody T,LEATHER_CHESTPLATE,52,0.6419753086419753 | ||
Builders Shirt,DIAMOND_HOE,1015,0.6498079385403329 | ||
Camo Top,DIAMOND_SHOVEL,818,0.5236875800256082 | ||
Chicken Wings,DIAMOND_SHOVEL,894,0.5723431498079385 | ||
Crier Coat,DIAMOND_HOE,1194,0.764404609475032 | ||
Druids Robe Top,LEATHER_CHESTPLATE,86,1.0617283950617282 | ||
Elder Chaos Top,LEATHER_CHESTPLATE,22,0.2716049382716049 | ||
Gold Elegant Blouse,DIAMOND_HOE,1196,0.765685019206146 | ||
Gold Elegant Shirt,DIAMOND_HOE,1198,0.7669654289372599 | ||
Green Dhide Body,LEATHER_CHESTPLATE,16,0.19753086419753085 | ||
Green Dhide Body G,LEATHER_CHESTPLATE,34,0.41975308641975306 | ||
Green Dhide Body T,LEATHER_CHESTPLATE,48,0.5925925925925926 | ||
Green Elegant Blouse,DIAMOND_HOE,1200,0.7682458386683738 | ||
Green Elegant Shirt,DIAMOND_HOE,1202,0.7695262483994878 | ||
Grey Robe Top,LEATHER_CHESTPLATE,68,0.8395061728395061 | ||
Guthix Platebody,LEATHER_CHESTPLATE,41,0.5061728395061729 | ||
Guthix Robe Top,DIAMOND_HOE,1208,0.7733674775928296 | ||
Ham Shirt,LEATHER_CHESTPLATE,85,1.0493827160493827 | ||
Hardleather Body,LEATHER_CHESTPLATE,15,0.18518518518518517 | ||
Iron Chainbody,LEATHER_CHESTPLATE,6,0.07407407407407407 | ||
Iron Platebody,LEATHER_CHESTPLATE,7,0.08641975308641975 | ||
Iron Platebody G,LEATHER_CHESTPLATE,28,0.345679012345679 | ||
Iron Platebody T,LEATHER_CHESTPLATE,53,0.654320987654321 | ||
Khazard Armour,DIAMOND_HOE,987,0.6318822023047375 | ||
Leather Body,LEATHER_CHESTPLATE,14,0.1728395061728395 | ||
Lederhosen Top,DIAMOND_HOE,545,0.3489116517285531 | ||
Mime Top,DIAMOND_HOE,726,0.4647887323943662 | ||
Mithril Chainbody,LEATHER_CHESTPLATE,8,0.09876543209876543 | ||
Mithril Platebody,LEATHER_CHESTPLATE,9,0.1111111111111111 | ||
Mithril Platebody G,LEATHER_CHESTPLATE,31,0.38271604938271603 | ||
Mithril Platebody T,LEATHER_CHESTPLATE,56,0.691358024691358 | ||
Monks Robe Top,LEATHER_CHESTPLATE,24,0.2962962962962963 | ||
Monks Robe Top G,LEATHER_CHESTPLATE,39,0.48148148148148145 | ||
Mystic Robe Top Blue,LEATHER_CHESTPLATE,66,0.8148148148148148 | ||
Mystic Robe Top Dark,LEATHER_CHESTPLATE,64,0.7901234567901234 | ||
Mystic Robe Top Light,LEATHER_CHESTPLATE,65,0.8024691358024691 | ||
Pink Elegant Blouse,DIAMOND_HOE,1212,0.7759282970550576 | ||
Pink Elegant Shirt,DIAMOND_HOE,1214,0.7772087067861716 | ||
Priest Gown Top,LEATHER_CHESTPLATE,25,0.30864197530864196 | ||
Prince Tunic,DIAMOND_HOE,1189,0.7612035851472471 | ||
Princess Blouse,DIAMOND_HOE,1190,0.7618437900128041 | ||
Purple Elegant Blouse,DIAMOND_HOE,1216,0.7784891165172855 | ||
Purple Elegant Shirt,DIAMOND_HOE,1219,0.7804097311139564 | ||
Purple Robe Top,LEATHER_CHESTPLATE,69,0.8518518518518519 | ||
Red Dhide Body,LEATHER_CHESTPLATE,19,0.2345679012345679 | ||
Red Dhide Body G,LEATHER_CHESTPLATE,37,0.4567901234567901 | ||
Red Dhide Body T,LEATHER_CHESTPLATE,51,0.6296296296296295 | ||
Red Elegant Blouse,DIAMOND_HOE,1222,0.7823303457106273 | ||
Red Elegant Shirt,DIAMOND_HOE,1224,0.7836107554417413 | ||
Red Robe Top,LEATHER_CHESTPLATE,70,0.8641975308641975 | ||
Rogue Top,DIAMOND_PICKAXE,1556,0.996158770806658 | ||
Rune Chainbody,LEATHER_CHESTPLATE,10,0.12345679012345678 | ||
Rune Platebody,LEATHER_CHESTPLATE,11,0.13580246913580246 | ||
Rune Platebody G,LEATHER_CHESTPLATE,33,0.4074074074074074 | ||
Rune Platebody T,LEATHER_CHESTPLATE,58,0.7160493827160493 | ||
Saradomin Platebody,LEATHER_CHESTPLATE,42,0.5185185185185185 | ||
Saradomin Robe Top,DIAMOND_HOE,1227,0.7855313700384122 | ||
Shade Robe Top,DIAMOND_PICKAXE,99,0.06338028169014084 | ||
Skeleton Shirt,DIAMOND_PICKAXE,175,0.11203585147247119 | ||
Splitbark Body,DIAMOND_HOE,1098,0.702944942381562 | ||
Steel Chainbody,LEATHER_CHESTPLATE,12,0.14814814814814814 | ||
Steel Platebody,LEATHER_CHESTPLATE,13,0.16049382716049382 | ||
Steel Platebody G,LEATHER_CHESTPLATE,29,0.35802469135802467 | ||
Steel Platebody T,LEATHER_CHESTPLATE,54,0.6666666666666666 | ||
Studded Body,DIAMOND_PICKAXE,423,0.2708066581306018 | ||
Studded Body G,DIAMOND_PICKAXE,424,0.2714468629961588 | ||
Studded Body T,DIAMOND_PICKAXE,425,0.2720870678617157 | ||
Teal Robe Top,LEATHER_CHESTPLATE,71,0.8765432098765431 | ||
White Elegant Blouse,DIAMOND_HOE,1229,0.7868117797695262 | ||
White Platebody,LEATHER_CHESTPLATE,26,0.32098765432098764 | ||
Yellow Robe Top,LEATHER_CHESTPLATE,72,0.8888888888888888 | ||
Zamorak Platebody,LEATHER_CHESTPLATE,43,0.5308641975308641 | ||
Zamorak Monk Top,LEATHER_CHESTPLATE,21,0.25925925925925924 | ||
Zombie Shirt,DIAMOND_PICKAXE,962,0.615877080665813 |
Oops, something went wrong.