#Difference between onUse Methods

1 messages · Page 1 of 1 (latest)

naive bramble
#

Is there a practical difference between the following two methods on doing item onUse other than text size?

#

M1:

import { world } from "@minecraft/server"

const onUseComp = {
    onUse({ source, itemStack }) {
        world.sendMessage('Item used: ' + itemStack.typeId);
    }
}

world.beforeEvents.worldInitialize.subscribe(({ itemComponentRegistry }) => {
    itemComponentRegistry.registerCustomComponent('mc:on_use_component', onUseComp);
});
#

M2:

world.afterEvents.itemUse.subscribe(({itemStack, source: player}) => {
    if (itemStack?.typeId == "mvm:flare_thrown") {
        world.getDimension("overworld").playSound("firework.launch", player.location)
    }
})```
#

I've seen both sent around here and I'm curious about whether there is or isn't any practical difference between them

steel pilot
naive bramble
steel pilot
naive bramble
#

Oooh sounds silly

#

Don't see how that could make a difference in most situations though