#Why doesn't this function work?
49 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Like the game literally doesn't open
event.modify('minecraft:sweet_berries', item => {
item.foodProperties
.effect('minecraft:poison',1200,1,1)
.hunger(0.5)
}
)
does this work?
it means that the function effect is non-existent
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
the blue meth from create broken bad, i made it edible using ".effect"
@willow kettle I hate to bother you lmao but like..............................................................
you know how to magically make creepers explode
effects is actually private. you have to use food properties builder
hmmm which you cannot apply
I just tested this, it seems to be the same on my end
why is it private?
~~use mixin to make an accessor 😂 ~~
So am I shit outta luck lol
oh
apparently the wiki says to use {item}.food(foodModifier => {your_stuff_goes_here})
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
the confusing part is item supposed to be item builder, but it's returning a normal minecraft item
from what i can tell
thats really strange
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
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
so it's this actually
ItemEvents.modification(event => {
event.modify('minecraft:apple', item => {
item.foodProperties = food => {
food.effect(ResourceLocation mobEffectId, int duration, int amplifier, float probability)
}
})
})
i just noticed here you just straight up did .effect, not food.effect
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
kubejs wiki is very outdated & underdeveloped
Ight ya it worked, thanx y'all