import * as mc from "@minecraft/server"

//put all your custom item setups in this array
const itemComponents = [
    {
        id: "pb_dino:fuel_can_full",
        code: {
            onBeforeDurabilityDamage: (data) => {
                fuelCan.beforeDurabilityDamage(data)
            }
        }
    }
]

//register components from array
mc.world.beforeEvents.worldInitialize.subscribe((data) => {
    for (const comp of itemComponents) {
        data.itemComponentRegistry.registerCustomComponent(comp.id, comp.code);
    }
});

//make up some manager class per item to handle events
export class fuelCan {
    static beforeDurabilityDamage(data) {
        data.durabilityDamage = 0;
    }
}