#Why doesn't this function work?

49 messages · Page 1 of 1 (latest)

kindred prawn
#
event.modify('minecraft:sweet_berries', item => {
        item.foodProperties = food => {
            .effect('minecraft:poison',1200,1,1)
            .hunger(0.5)
        }
    })
tender oarBOT
#

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

kindred prawn
#

Like the game literally doesn't open

west creek
#
event.modify('minecraft:sweet_berries', item => {
    item.foodProperties
        .effect('minecraft:poison',1200,1,1)
        .hunger(0.5)
    }
)

does this work?

kindred prawn
#

I'll let ya know, mc is loading

#

fingers crossed

lavish leaf
#

in item.foodProperties

#

it might be item.foodProperties()

#

although it seems to be right. so perhaps it might be .statusEffect or effects

#

or addEffect

#

If you use ProbeJS, it will tell u

kindred prawn
#

but this works just fine

kindred prawn
#

the blue meth from create broken bad, i made it edible using ".effect"

kindred prawn
#

@willow kettle I hate to bother you lmao but like..............................................................

#

you know how to magically make creepers explodezoomeyes

willow kettle
#

effects is actually private. you have to use food properties builder

#

hmmm which you cannot apply

lavish leaf
#

why is it private?

#

~~use mixin to make an accessor 😂 ~~

kindred prawn
#

So am I shit outta luck lol

willow kettle
#

oh

lavish leaf
#

apparently the wiki says to use {item}.food(foodModifier => {your_stuff_goes_here})

willow kettle
#

i need to test this. give me a sec

#

i think i know what to do

lavish leaf
#

it might be this... maybe?

event.modify('minecraft:sweet_berries', item => {
    item.food(food -> {
        food.effect('minecraft:poison',1200,1,1)
        food.hunger(0.5)
    })
)
#

yeah probejs seems to agree

willow kettle
#

the confusing part is item supposed to be item builder, but it's returning a normal minecraft item

#

from what i can tell

lavish leaf
#

Probejs says its deprecated

#
event.modify('minecraft:sweet_berries', item => {
        item.setFoodProperties(food => {
            food.effect('minecraft:poison',1200,1,1)
            food.hunger(0.5)
        })
    })
#

this should be the correct one, just made it and everything checks out

willow kettle
#

contemplating on installing vscode, then again

#

meh

lavish leaf
#

ProbeJS is better than looking at source code directly

#

I can't believe I used to do that shit when 1 mod fixes all of it

willow kettle
#

so it's this actually

willow kettle
#

gg

#

think it's time for me to hit the bed

#

to be fair, i never touched item modification before, or food properties so this is new to me but now i know how it works

lavish leaf
kindred prawn
#

Ight ya it worked, thanx y'all