#Can I make custom edible items give you effects?

1 messages · Page 1 of 1 (latest)

shrewd delta
#

Trying to make it give the player hunger

supple shadow
#

Yes

#

With beforeItemUse

#
import { world, MinecraftEffectTypes } from "@minecraft/server"
world.events.beforeItemUse.subscribe(e => {
   if (e.item.typeId !== "youritemId")
      return;
        e.source.addEffect(MinecraftEffectTypes.hunger, timeInTicks, duration, showParticles? true or false)
})
#

You can also do this directly with json

hearty saffron
#

I would recommend doing it in the json file of the item

supple shadow
#

I too

#

But he added the tag scripting so that's why he got a scripting method