#Nullify effect given of a consumable

25 messages · Page 1 of 1 (latest)

gritty violet
#

Concretely FD mixed salad. I want to remove the regeneration effect it gives. I know how to add effects, but not removing them.

coarse larkBOT
#

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

icy kelp
#

??kjswiki

nocturne frigateBOT
# icy kelp ??kjswiki

You can modify various properties of an existing item with KubeJS, and the wiki has a page on it!

icy kelp
#
ItemEvents.modification(event => {
  event.modify('minecraft:diamond', item => {
    item.foodProperties = food => {
        food.hunger(2)
        food.saturation(3)
        food.fastToEat(true)
        food.eaten(e => e.player.tell('you ate')) // this is broken, use ItemEvents.foodEaten instead.
    }
  })

  event.modify('pumpkin_pie', item => {
    item.foodProperties = null // make pumpkin pies inedible
  })
})``` you can run an event to clear the effect when you eat it in the item modification startup event
gritty violet
#

But if I'd have regeneration previously, it would remove it

abstract coral
#

you might be able to check for the exact duration and level of the effect, and only remove it if it matches exactly, still an edge case, but it is an extreme edge case, you would have to eat it at the exact right tick

#

that might require a delay, or just strictly not be possible for whatever reason

icy kelp
#

try overriding it with regeneration 1 for 0/1 ticks

#

i know if you modify the effect given to the food it disables the other effects it usually gives, for example i modified panthalassa's fish meat to give potion effects where it gave you hunger before

#

i didnt have to remove it or anything

civic leaf
#

is there not an event to clear effects

#

or does it not work for specific effects

icy kelp
#

there is

civic leaf
#

is that what they want or am i misunderstanding

icy kelp
#

though like kokoroto said if he has regeneration beforehand

civic leaf
#

ohh

icy kelp
# gritty violet But if I'd have regeneration previously, it would remove it

try this js event.modify('modid:itemid', item => { item.foodProperties = food => { food .effect('minecraft:strength', 1, 0, 0) } }); that last 0 in 1, 0, 0 is the probability of getting the potion effect so setting it to 0 wil obviously make sure you never get it, if that doesnt work then try setting it to 1 and change the 1 at the start to a 0, thats the duration

#

should overwrite the effect

gritty violet
#

Not at home rn, will try tonight (9h aprox), but thanks n_n

gritty violet
#

Sorry, I forgot to reply

#

I found a workaround, but it didn't help any way

#

Thank you as always @icy kelp

#

Hope you don't mind I close this