PlayerWaypoints
基于服务器的模组,使用 Polymer 的虚拟实体 API 在定位栏中添加自定义航点
允许创建按世界和按玩家的航点,并且可以像其他虚拟实体一样附加。
使用方法:
全局航点:
全局航点将发送给位于该航点所在世界的所有玩家。
PlayerWaypointManager.addGlobalWaypoint(serverWorld, pos, id) -> WaypointElement
PlayerWaypointManager.addGlobalWaypoint(serverWorld, waypointElement) -> WaypointElement
移除航点:
PlayerWaypointManager.removeGlobalWaypoint(serverWorld, waypointElement) -> void
按玩家航点:
如果玩家与航点位于同一世界,则向该玩家发送按玩家航点。
PlayerWaypointManager.addPlayerWaypoint(player, serverWorld, pos, id) -> WaypointElement
PlayerWaypointManager.addPlayerWaypoint(player, serverWorld, waypointElement) -> WaypointElement
移除航点:
PlayerWaypointManager.removePlayerWaypoint(player, serverWorld, waypointElement) -> void
与 Polymer 配合使用
航点基于 Polymer 的虚拟实体元素 构建,因此你可以像添加任何其他元素一样添加 WaypointElement。
WaypointElement 类
WaypointElements 是表示定位栏中基本航点的方式。
<ctor> WaypointElement(ServerWorld, Identifier)
配置
WaypointElement::getConfig(ServerPlayerEntity) : 获取航点的客户端绑定配置
WaypointElement::setColor(int) : 设置颜色 - RGB
WaypointElement::setStyle(RegistryKey<WaypointStyle>) : 设置航点样式 参见:Minecraft Wiki / 航点样式
- 航点样式注意事项:距离计算无法正常工作,因此它将始终显示“最远”的精灵。这不幸是一个 bug。
- 但是,你可以重写 getConfig(...) 并根据距离使用 getDistanceTo 手动更改样式。
定位与传输
WaypointElement::setWaypointTransmitRange(double) : 设置玩家可以看到航点的范围。超过此距离后,航点将停止传输。
WaypointElement::setPosition(Vec3d) : 设置航点的位置。
- 你也可以使用 setOffset(...) 获得相同的结果。
WaypointElement::isPlayerInRange(PlayerEntity) -> boolean : 航点是否应向此玩家传输。
WaypointElement::getObservers() -> Set<PlayerEntity> : 获取当前正在接收此航点传输的所有玩家
WaypointElement::getDistanceTo(PlayerEntity)
WaypointElement::getSquaredDistanceTo(PlayerEntity 获取航点到给定玩家的距离
航点全息投影(进行中)
WaypointElements 可以附加全息投影,以向用户显示信息。
默认情况下,全息投影将直接显示在航点上方。
这是非常实验性的功能,可能无法正常工作。我建议单独构建全息投影。
可以使用 getHologramElementPosition 覆盖此行为。
WaypointElement::setHologram(List<Text>) : 使用 MarkerElements 设置航点的全息投影
WaypointElement::setHologram(List<HologramData>) : 设置航点的全息投影
WaypointElement::removeHologram(HologramData) : 从航点移除全息投影。
getHologramElementPosition(Vec3d origin, int line, HologramData) -> Vec3d : 获取全息投影元素的位置
默认为 origin.offset(Direction.UP, (line * 0.25f))
其他实用工具
SVPlayerWaypoints.getHolderForWorld(ServerWorld) : 获取精确位于 [0,0,0] 处的持有者
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]
评论 0
登录后参与评分
还没有评论,来抢沙发吧