i wanted to create drunk effect as the food item is a beer. I am trying to create a stagger like effect where the player would randomly move. I ended up coding the effect into the onItemUseFinish. But I'm unsure how to keep its effect working for an extended period of time. Using a loop gives me: The client has sent too many requests within a certain amount of time
Well, I'm taking a look at the chorus fruit's code from vanilla, seems decently similar to what you're wanting to do, just add the movement as a method, and remove the random teleport and you should be decently golden. Here is the code for the random tp from chorus fruit.
Does pretty much what you did, I can't help with specifics, sorry. I'm not that advanced yet.
just use a while loop inside the method that checks if the player has the potion effect, then execute random movement patterns. Don't be afraid to shake the camera a bit either, that'd be cool! Please either post here or dm a github link or a place I can keep up to date with minor changes. I'd love to keep up with your progress. Perhaps we can learn from each other, since (pretty sure you're also new to modding) we're both noobs