#Modify an item in KubeJS6

24 messages · Page 1 of 1 (latest)

mild rampart
#

I'm trying to modify an existing item to make it edible but i cant find any methods for doing this on version 6, it not on the wiki so how else can i find out how to do this?

celest copperBOT
#

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

turbid gorge
#

its exactly the same as the old syntax except with a new event

#

??kjswiki

nimble sluiceBOT
turbid gorge
#

get the item modify event from there (use ctrl +f to search it for modif and then use that instead of the old event in the old example, with the rest the same

mild rampart
#

I think i applied it properly, but it still isnt working. No errors when reloading though

ItemEvents.modification(e => {
    e.modify('forge:super_glue', item => {
        food.hunger(4)
        food.saturation(3)
        food.alwaysEdible();
    })
  })```
turbid gorge
#

item modification isnt reloadable

#

its startup and needs a game restart

mild rampart
#

Still not working after a game restart,

turbid gorge
#

why do u have a mod who is adding items to the forge namespace?

mild rampart
#

What do you mean?

#

huh, i never noticed i typed forge instead of create

turbid gorge
mild rampart
#

lemme try changing that

#

I get this error now:
Error occurred while handling event 'ItemEvents.modification': TypeError: Cannot find function hunger in object super_glue. (startup_scripts:glue_edible.js#3)
Not sure how tough, i thought item.alwaysEdible(); would add hunger properties to that item

turbid gorge
#

those are all food builder methods

#
e.modify('item', item => {
    item.food(food => {
      food.hunger(2)
    })
})
mild rampart
#

This still gives me a syntax error

ItemEvents.modification(e => {
    e.modify('create:super_glue', item => {
        item.food(food => {
            food.hunger(4)
            food.saturation(3)
            food.alwaysEdible(true);
        })
    })
})

Error occurred while handling event 'ItemEvents.modification': TypeError: Cannot find function food in object super_glue. (startup_scripts:glue_edible.js#3)
(thanks for helping my thus far btw)

turbid gorge
#

oh its .foodProperties = food => {

mild rampart
#

you mean like this?

ItemEvents.modification(e => {
    e.modify('create:super_glue', item => {
        item.foodProperties(food => {
            food.hunger(4)
            food.saturation(3)
            food.alwaysEdible(true);
        })
    })
})

it still doesnt work

fiery nova
#

no, like this:

ItemEvents.modification(e => {
    e.modify('create:super_glue', item => {
        item.foodProperties = food => {
            food.hunger(4)
            food.saturation(3)
            food.alwaysEdible(true)
        }
    })
})
turbid gorge
#

its really odd syntax

mild rampart
#

yes that was it! thanks alot ❤️