#how would I go about making a item that gives a effect when held in the main hand?

8 messages · Page 1 of 1 (latest)

simple night
#

trying to make a custom sword that give speed when held.

hazy cipherBOT
#

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

simple night
#

just gonna bump this, help would be much appreciated

humble bone
#

ok this is very late, but i just figured it out after searching and finding this post had no answer, so here's what i used to figure out the pieces

PlayerEvents.tick(event => {
    event.player.potionEffects.add('minecraft:speed', 2, 0, false, false);
    let held_item = event.player.getHeldItem("main_hand")
    event.server.tell(held_item)
})

#

just need to filter by held item and actually organize the code now

humble bone
#

ok, this works for my purposes, but it doesn't seem to be able to do things like poison the user cause it's constantly refreshing

humble bone
#

wait, im just being dumb lol
i was treating the duration like seconds, not ticks

elfin willow
#

You might be able to do this with a attribute modifier? I'm not well versed though. I know there's an example somewhere how to do it tho