Minecraft Data Packs / Server Utility

Limited Spectator Mode

  • check_circle Functions
  • 10,264 views, 20 today
  • 870 downloads, 2 today
  • 12
  • 6
  • 12
Tirco avatar Tirco
Level 25 : Expert Modder
2
Limited Spectator Mode
is a datapack for Minecraft 1.14+ that enables all players to enter Spectator Mode whenever they want, with a few restrictions.

Restrictions:


1) The player can not travel more than 64 blocks away from where they enabled the spectator mode. If they try to fly further, they will be teleported back to their point of origin.

2) Upon leaving spectator mode, they will be teleported to the point they started, to prevent using the mode as a means of transportation.

How it works:


- Upon joining the server, every player is given a unique ID, stored in the scoreboard value sp_id.

- When they use the command "/trigger sp_on" they will go in to spectator mode, and an armorstand will be summoned at their location, with the same ID as the player.
(The location is shown by a floating golden helmet for players that are not in spectator mode)

- The armorstand will constantly check if the player is within a 64 block radius, and teleport them back if they go to far.

- To leave spectator mode, they player will have to use "/trigger sp_off" this will teleport the player back to the armorstand, and disable spectator mode.

Known "bugs":


1) Unloaded Chunks. (FIXED in latest version)
- If a player teleports away from their armorstand while in spectator mode, and the chunks they were in gets unloaded before the player gets properly teleported, they can move freely in spectator mode. This is only until the chunk with their armorstand gets loaded again. This is unfixable until mojang implements a stable way of keeping a chunk loaded. (the /forceload command can not be used by a datapack, sadly...)

I have implemented a function so that they can not use /trigger sp_off until the chunk with their armorstand is loaded, to prevent using the spectator mode as a mode of teleportation.

Status: Unfixable.

2) Bad admin...

- If an administrator uses /kill @e to kill the armorstand, spectators are stuck in spectator limbo, until an administrator saves them. This is done by using the following commands:

- /scoreboard players <playername> set sp_status 0
- /gamemode <playername> survival.


This should allow them to use the command again freely.

Status: User error...

How to install:


1) Add the spectate.zip file to your datapacks folder.
2) Restart the world/server or use the command /reload.


How to uninstall:


1) Delete the datapack from your datapack folder.
2) Restart the world/server or use the command /reload.
3) Run the following commands to clear the scoreboard values:



/scoreboard objectives remove sp_id
/scoreboard objectives remove sp_off
/scoreboard objectives remove sp_on
/scoreboard objectives remove sp_selector
/scoreboard objectives remove sp_status
CompatibilityMinecraft 1.15
Tags

2 Update Logs

Update #2 : 02/19/2020 6:00:02 amFeb 19th, 2020

Updated to 1.15.2. All I had to do was change the pack format. Let me know if there are issues :)
LOAD MORE LOGS

Create an account or sign in to comment.

1
08/22/2020 10:33 am
Level 1 : New Miner
nikit204
nikit204 avatar
1.16?
1
08/23/2020 3:22 pm
Level 25 : Expert Modder
Tirco
Tirco avatar
Should work just fine without updating. Might be listed as outdated, so I'll look into it when I have the time :)
1
06/21/2020 2:58 pm
Level 1 : New Miner
EgErVali
EgErVali avatar
I have a question... If the player is teleported back to the original position after leaving spectator mode then why is the 64 block radius restriction necessary? And in addition, only 64 blocks? That's not a lot.
1
06/02/2020 1:22 pmhistory
Level 1 : New Miner
Raiders_Play
Raiders_Play avatar
Hi
This is what I was looking for my server, allowing players to be able to switch to spectator.
Getting a weird issue since installing.

Respawn bed is lost.
Getting "Your home bed was missing or obstructed" when going through the portal at the end.

I've tried uninstalling but the problem persists...
...
1
06/02/2020 2:30 pm
Level 1 : New Miner
Raiders_Play
Raiders_Play avatar
Some more testing and removing and adding things... It seems to be related to setting the spawnpoint when clicking/sleeping on a bed. If I use the /spawnpoint command it works.

So the respawn point on beds is broken now.
1
06/03/2020 12:39 am
Level 1 : New Miner
Raiders_Play
Raiders_Play avatar
Somehow the bed spawn changed...

My base the bed is surrounded with halfslabs, making it look like it is level with the floor and preventing mob spawning.

This behavior has now change. Now I have to remove the half slabs around the beds...
1
01/11/2020 2:54 pm
Level 1 : New Miner
Cayderino
Cayderino avatar
Any possibility that you will update this for 1.15.1? My server has used your datapack for as long as we had 1.14.4 and everyone loved it! :)
1
02/19/2020 6:00 am
Level 25 : Expert Modder
Tirco
Tirco avatar
Should work fine with any version. To be safe I updated the Pack.mcmeta to v5, and tested it. Worked fine. :)
1
08/24/2019 10:19 am
Level 1 : New Miner
Inputifo
Inputifo avatar
Is there anyway to add a shortcut key to activate it?
1
08/28/2019 1:40 am
Level 25 : Expert Modder
Tirco
Tirco avatar
Sadly, this can't be done with a datapack, as keybinds are handled clientside.



You could download a mod that allows you to create Macros, and bind the command to that macro.
2
07/26/2019 1:29 am
Level 9 : Apprentice Miner
waifubeforelaifu
waifubeforelaifu avatar
Hey btw as of 1.14.4 you can use /forceload in a datapack, so that bug is fixable now.
1
08/28/2019 1:41 am
Level 25 : Expert Modder
Tirco
Tirco avatar
Oh, this has flown right past me!

Thank you for bringing this to my attention.



Expect an update by the end of the week.
Planet Minecraft

Website

© 2010 - 2021
www.planetminecraft.com

Welcome