This datapack depends on: DrakonCore
Manhunt Compass replicates the compass from Dream's Manhunts, allowing players to join the Speedrunner or Hunter team. The Hunters all receive a Compass of Tracking, which points towards the Speedrunner.
The mechanics of the Compass of Tracking are directly inspired by Dream's manhunts and CivetKitty's Manhunt Target Tracker datapack. However, it is more optimized than CivetKitty's version (since it only works for a single player) and works correctly in different dimensions. In addition, it is less robust and does not track win conditions, making it more flexible for different win conditions and more similar to Dream's original. The Compass of Tracking works as follows:
The compass is placed into the Hunter's last (rightmost) hotbar slot.
It does not drop upon death, and will be destroyed if dropped as an item. Duplicate compasses and compasses held by non-Hunter players are also removed.
If lost, the compass will be given back to the Hunter unless there is currently an item in the rightmost hotbar slot. Until that slot is empty, the compass will not be returned.
The compass stops updating if it is not in the correct slot, and thus should not be moved for any reason.
The compass also stops updating if 1) there is no Speedrunner present or 2) the Speedrunner is not in the same dimension as the Hunter.
The latter condition means that if the Speedrunner goes to a different dimension, the compass points towards the Speedrunner's last known position in the Hunter's dimension, allowing the Hunter to find the Speedrunner's portal.
Use /trigger manhunt to display the role selection screen, where the player can choose to be the Speedrunner, a Hunter, or remove their current role. There can only be up to one Speedrunner at any time. There can be any number of Hunters.
Unlike many Manhunt Compass datapacks, this datapack is extremely lightweight and strongly mirrors Dream's original compass implementation. It does not detect whether any team wins or loses, allowing the players to define their own win conditions; in essence, this datapack only introduces a compass capable of tracking a single player. This opens a myriad of possibilities and variations for players to try on their own, instead of forcing a single ruleset. Since it does not use any "hacks" that interfere with other game mechanics (see below), it also is perfectly suited for any kind of gameplay. For example:
Under different rulesets, a Bodyguard or Traitor can join the "Hunter's" team just to receive the Compass of Tracking, which allows them to track the Speedrunner to assist them.
The compass implementation inspired by CivetKitty is extremely elegant, and utilizes 1.17 features to create it in few lines of code (unlike many other compass implementations, which require "hacks" such as setting the world spawn (which means players must use and cannot break beds) or many, many commands. CivetKitty has their own explanation, but I will summarize the general ideas here since it is so interesting:
The compass is actually a Lodestone compass; however, there is no actual Lodestone present. Instead, an invisible armor stand following the Speedrunner holds the most up-to-date copy of the Manhunt compass in its inventory, which stores the Speedrunner's location and dimension. This modifies the compass's data directly instead of using a Lodestone block.
/item replace is used to copy the compass from the armor stand into the Hunter's hotbar slot, which was not possible before 1.17.
Usually, Lodestone compasses spin wildly if the compass is not in the same dimension as the destination; however, my version instead stops updating the compass's location if the Hunter is not in the same dimension as the Speedrunner. While the compass works in all dimensions when both players are in the same dimension, this feature allows the compass to point towards the Speedrunner's portal. CivetKitty's version does not do this, and actually fails to copy the dimension data correctly due to a typo.