Topic category: Help with Minecraft modding (Java Edition)
I'm trying to create a sort of chaos mode that randomly chooses an event to happen every now and then. It's a gamerule that can be toggled on and off and it also has a global variable ChaosVar which is where the current event is stored(its possible values will change but currently they range from -1 to 5). One of the events is supposed to make every entity fly high up into the sky if it's grounded or in water(tho it's only a chance per tick). For other entities I used on loaded entity tick update and it works. For players, however, I tried to use on player update tick, and nothing seems to happen. The player doesn't get sent flying up like they're supposed to be.
Here's what I used for players https://imgur.com/6FARmGk
Same thing for entities(well, almost) https://imgur.com/b530mKi
Can anyone help me? I've tried everything, even using other stuff like when player lefts clicks a block, it didn't change anything.
try and change it to world tick update, and for each player in the world as entity iterator. Then replace all of the event/target entities with entity iterator.
Still doesn't work(don't mind the fact I changed the odds, I just did that to make sure I wasn't getting unlucky or something) - https://imgur.com/a/e4beme2
I ended up "solving" it with the following method: instead of overriding motion vector, the procedure now places down a pressure plate-like block which sends you flying when you collide with it. I tried the "when entity walks on the block" trigger and it didn't work, but with the "when entity collides in the block" trigger, it actually does. It's not a great solution but it does the job. Still, if anyone finds a proper solution, please do let me know.