Started by
St_428
on
Topic category: Help with Minecraft modding (Java Edition)
I am creating some items that when right-clicked, allow you to change gamemode. I created the procedures for all of them except for spectator.
Since in spectator you cannot right-click on items/blocks, I wanted to set up the gamemode change in a temporary way, so that you have a certain amount of seconds in spectator mode to then go back to the one you were before. Unfortunately I can't figure out how to proceed. Despite the attempts to use procedures and variables, the game, once it changed the gamemode to spectator, seemed to be unresponsive to the 30-second timer I had set in the procedure to change my gamemode back to creative, (in my case).
have you tried using a custom potion effect?
For example, a potion effect that sets the players gamemode to spectator when its applied, then set it to a gamemode based on the amplifier of the potion effect when it expires.
I don't see any reason this wouldn't work, as I'm pretty sure potion effects (like night vision) are still active in spectator mode.
Ty so much, it hadn't even crossed my mind I could have used potions effects.
set game mode of event/target entity to survival
wait 20 ticks
- set game mode of event/target entity to creative