How do I disable the Spectator flight menu?

Started by PairOfPiplups on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I disable the Spectator flight menu?
Thu, 10/26/2023 - 22:14 (edited)

I want to use Spectator in a mod and disable your movement. I already have that down, but I need a way to stop the player from just opening the hot bar and teleporting to someone. Any help is appreciated, thank you!

Edited by PairOfPiplups on Thu, 10/26/2023 - 22:14
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have an idea: If you make…
Thu, 10/26/2023 - 23:35

I have an idea: If you make 3 global number variables, one for each of the player's x, y and z positions. Then, right at the start of when the player is put into spectator mode, have those 3 variables set to the players current position (have this happen only once right when they are put into this frozen state). Then make a procedure that runs every tick that sets the players position to those values of the global variables. So they would be able to teleport to someone, but a twentieth of a second later they would be teleported back.