#Script making food Always Edible replaced other food component parts

5 messages · Page 1 of 1 (latest)

hot locust
#
//in startup_scripts
ItemEvents.modification(event => {
  event.modify('minecraft:golden_carrot', item => {
    item.food = {
      alwaysEdible: true
    }
  })
})

This works, but it sets all the other parts (consumption time, saturation, etc) to 0. I tried making a copy of the food component but couldn't figure out the syntax. I could set the other components here to the defaults and that would also work but it would make more sense to make a copy

candid gobletBOT
#

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

bronze herald
#

Example, where I copy over original nutrition and saturation from base food components

#

BTW - you don't need every single key in the object passed to setFood - the missing components will be null (non-existent) if you don't specify them