PlayerWaypoints

Mod

Server-side mod for adding custom waypoints to the Locator Bar using Polymer's Virtual-Entity API

Server

31 downloads
1 follower
Follow Save

PlayerWaypoints

Server-side mod for adding custom waypoints to the Locator Bar using Polymer's Virtual-Entity API

Allows for creation of waypoints per-world as well as per-player, and can be attached like any other virtual entity.

How to use:

Global Waypoints:

Global waypoints will be sent to all players in the world the waypoint is in.

PlayerWaypointManager.addGlobalWaypoint(serverWorld, pos, id) -> WaypointElement PlayerWaypointManager.addGlobalWaypoint(serverWorld, waypointElement) -> WaypointElement

Removing a waypoint:

PlayerWaypointManager.removeGlobalWaypoint(serverWorld, waypointElement) -> void

Per-Player Waypoints:

Per-Player waypoints will be sent to the player if they are in the same world.

PlayerWaypointManager.addPlayerWaypoint(player, serverWorld, pos, id) -> WaypointElement PlayerWaypointManager.addPlayerWaypoint(player, serverWorld, waypointElement) -> WaypointElement

Removing a waypoint:

PlayerWaypointManager.removePlayerWaypoint(player, serverWorld, waypointElement) -> void

Using with Polymer

The waypoints are built upon Polymer's Virtual Entity Element, so you can add a WaypointElement the same way you would any other element.

The WaypointElement Class

WaypointElements are the basic way of representing a waypoint for the Locator Bar

<ctor> WaypointElement(ServerWorld, Identifier)

Config

WaypointElement::getConfig(ServerPlayerEntity) : Gets the Waypoint's client-bound config

WaypointElement::setColor(int) : Sets the color - RGB

WaypointElement::setStyle(RegistryKey<WaypointStyle>) : Sets the Waypoint's style See: Minecraft Wiki / Waypoint Style
- Note for Waypoint Styles: Distance calculation isn't working, so it will always show the "furthest" sprite. This is unfortunately a bug.
- However, you can override getConfig(...) and change the style manually depending on the distance using getDistanceTo.

Positioning and transmission

WaypointElement::setWaypointTransmitRange(double) : Sets the range the player can see the waypoint. The waypoint will stop transmitting after this distance.

WaypointElement::setPosition(Vec3d) : Sets the position of the waypoint.
- You can also use setOffset(...) for the same result.

WaypointElement::isPlayerInRange(PlayerEntity) -> boolean : Whether the waypoint should transmit to this player or not.

WaypointElement::getObservers() -> Set<PlayerEntity> : Gets all players which this Waypoint is currently transmitting to

WaypointElement::getDistanceTo(PlayerEntity)
WaypointElement::getSquaredDistanceTo(PlayerEntity Get distance to a given player from the Waypoint

Waypoint Holograms (WIP)

WaypointElements can have Holograms attached, to display information to the user.
By default, holograms will display directly above the Waypoint.

This is very experimental, and may not work. I'd recommend just building holograms separately.

This can be overridden using getHologramElementPosition

WaypointElement::setHologram(List<Text>) : Sets the Hologram of the Waypoint using MarkerElements
WaypointElement::setHologram(List<HologramData>) : Sets the hologram of the Waypoint

WaypointElement::removeHologram(HologramData) : Removes a Hologram from the Waypoint.

getHologramElementPosition(Vec3d origin, int line, HologramData) -> Vec3d : Gets the position of a Hologram element
Defaults to origin.offset(Direction.UP, (line * 0.25f))

Other utilities

SVPlayerWaypoints.getHolderForWorld(ServerWorld) : Gets a holder at exactly [0,0,0]


Project members

Feintha

Member

Details

Licensed WTFPL
Published 3 months ago
Updated 4 months ago