#How to give an item to player after eating something

8 messages · Page 1 of 1 (latest)

sacred pewter
#

I've added canned beans to my modpack, and I want it to return a normal tin can after the player eats the beans. (Like how you recieve an empty bottle after drinking a potion)

mental oreBOT
#

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

cosmic sorrel
#

it should look like this:

event
    .create("ravioli_can")
    .displayName("Ravioli Can")
    .food((food) => {
      food
        .hunger(10)
        .saturation(1.2)
        .eaten((ctx) => {
          ctx.player.give("kubejs:labeled_can");
        });
    })
    .useAnimation("drink");

for my code when you have eaten the Ravioli Can you get a empty can.
It is in the startup_script where you register your Items

sacred pewter
#

This is true

#

Very nice, thanks!