Temporary gamemode change

Started by St_428 on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Temporary gamemode change

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).

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
have you tried using a…
Mon, 11/11/2024 - 00:30

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.

Joined May 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ty so much, it hadn't even…
Fri, 11/15/2024 - 23:30

Ty so much, it hadn't even crossed my mind I could have used potions effects.

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
set game mode of event…
Sat, 11/16/2024 - 22:26

set game mode of event/target entity to survival
wait 20 ticks
- set game mode of event/target entity to creative