#How to add a component to an item after it already exists

1 messages · Page 1 of 1 (latest)

tough snow
#

I'm trying to make an item that when eaten will turn into itself, and to do so I plan to have a command edit an item to have the component that makes it turn into that item when eaten if it has a specific custom_data component. However, I do not know how to change an item's components in that way.

wraith edgeBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

round gull
#

You can use item modifiers

tough snow
#

the documentation on those is a bit confusing, how would i format it to modify a specific component?

round gull
#

Like this:

{
  "function": "minecraft:set_components",
  "components": {
    "minecraft:food": {
      "nutrition": 0,
      "saturation": 0
    }
  }
}
tough snow
#

i see
thank you!

round gull
#

Except replace the values with whatever data you want

tough snow
#

let me try it out and then i'll mark this resolved

#

i may be a fool

#

i am in 1.20.6

#

well i'll resolve it anyways

wraith edgeBOT
# wraith edge <@&1201956957406109788>
Question Closed

Your question, #1249108563389972543 (How to add a component to an item after it already exists), was resolved!

Original Message

#1249108563389972543 message

Duration open

16m

round gull
#

1.21 is coming out next week though so you can make it then

wraith edgeBOT
wraith edgeBOT