I thought I could just save the value of the amount of xp to repair the item with and then apply it to the repair amount when trying to repair but I can't get anything to work and I have no idea what to do and googling doesn't help.
let original = {};
PlayerEvents.itemCrafted(event => {
let item = event.craftItem;
if (!original[item.id]) {
original[item.id] = item.repairCost;
}
});
PlayerEvents.tick(event => {
event.player.inventory.items.forEach(item => {
if (item && item.repairCost > 0) {
if (original[item.id]) {
item.repairCost = original[item.id];
} else {
item.repairCost = 0;
}
}
});
});
I'm not getting any error, it just doesn't work and I don't know any other way to go about it.