#Trying to make a script that removes the work penalty for anvils

5 messages · Page 1 of 1 (latest)

distant hazel
#

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.

simple mauveBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

rare compass
#

anvils have their own event, itemcrafted is only the crafting table and the 4x4 player grid

#

annnnnd.... only forge has that event and architectury doesn't add a fabric compat for that.... soooo.... probably not able to do through kjs