#Prevent eating food with the hunger effect

14 messages · Page 1 of 1 (latest)

copper forum
#

I want to dissuade players from eating raw food/rotten flesh in my modpack by having the hunger effect prevent eating food

lunar warrenBOT
#

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

eager musk
#

item foodEaten event

#

or item right click event, but instead of cancelling the event,~~ remove and give back the item~~

copper forum
#

I realise that I should have specified this but the part I don't understand about this is how to check if the player has the hunger effect.

eager musk
#

.hasEffect('asd')

copper forum
#

Alright I'll just add this to my code and make sure it works before closing the ticket, thanks for the help!

#

Something like this should work, right?

ItemEvents.rightClicked('#lttw:food', event => {
    if (event.player.hasEffect('minecraft:hunger')) {
        event.cancel()
    }
})```
eager musk
#

no

copper forum
#

okay i've got it working now, thanks!