跳到正文

PlayerWaypoints

作者:Feintha

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

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

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]

常见问题

PlayerWaypoints 支持哪些 Minecraft 版本?

PlayerWaypoints 支持 Minecraft Java 版 1.21.7,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

PlayerWaypoints 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。

评论

登录后评论和评分

Feintha 的其他作品

查看全部 →