玩家运动
Player Motion 是一个基于爆炸效果的库,它使用子刻计时(subtick timing)来确保只有目标玩家被爆炸推动,且不会产生任何副作用。
感谢 @BigPapi13 制作了本库所借鉴的原始库。本项目旨在取代它。
感谢 Minecraft Commands Discord 中的 nedraw 提供的末影水晶方法论及实现方案,这也是当前版本所基于的基础。
感谢 @SuperSwordTW 帮助进行了重大的数学性能与稳定性改进。
使用方法
向特定方向发射玩家
scoreboard players set $strength player_motion.api.launch 10000
function player_motion:api/launch_looking
$strength 代表每刻(tick)的位移量(以方块为单位),缩放系数为 10000。强度为 10000 将以每刻 1 个方块的速度推动玩家
- 函数被调用时的朝向方向即为玩家被发射的方向
- 只有执行命令的玩家会收到运动更新
使用 XYZ 向量发射玩家
scoreboard players set $x player_motion.api.launch 500
scoreboard players set $y player_motion.api.launch 12000
scoreboard players set $z player_motion.api.launch -3125
function player_motion:api/launch_xyz
$x、$y 和 $z 分别代表在 X、Y 和 Z 方向上推动玩家的强度(以每刻方块数计)
- 与之前一样,只有执行命令的玩家会被发射
注意:这些函数是叠加*的,它们会在现有运动的基础上额外施加运动,而不是直接将运动设置为输入值。
局限性 + 已知问题
尽管这个库可能是我们迄今为止最接近完美操控玩家运动的方案,但仍有一些值得提及的局限性:
- MSPT 不一致性:虽然施加的运动是恒定的,但服务器和客户端的更新速率可能会发生变化,如果每刻都调用运动更新,当这些差异变得过大时可能会导致不一致的结果。为了获得一致的效果,该库仅应用于瞬时爆发式的运动,而持续力应转而依赖骑乘机制或漂浮效果,具体取决于上下文。
如果你知道任何可能的解决方案,或者想帮忙修复这些问题,请告诉我!
Player Motion
Player Motion is an explosion-based library that uses subtick timing to ensure that only one player is pushed by the blast without any side effects.
Credit to @BigPapi13 for making the original library this is inspired by. This project aims to succeed it.
Credit to nedraw from the minecraft commands discord for the ender crystal methodology & implementation this is now based on.
Credit to @SuperSwordTW for helping make significant math performance & stability improvements.
How to use
Launching a player where in a specific direction
scoreboard players set $strength player_motion.api.launch 10000
function player_motion:api/launch_looking
$strength represents motion in blocks/tick, scaled by 10000. A strength of 10000 will push the player at 1 block/tick
- The facing direction in which the function is called is the direction the player will be launched
- Only the player executing the command will receive a motion update
Launching a player with xyz vector
scoreboard players set $x player_motion.api.launch 500
scoreboard players set $y player_motion.api.launch 12000
scoreboard players set $z player_motion.api.launch -3125
function player_motion:api/launch_xyz
$x, $y, and $z are the strength in blocks/tick to launch the player in the x, y, and z directions
- As before, only the player executing the command will be launched
*Note: These functions are additive and will apply motion in addition to existing motion rather than directly setting it to whatever input you send
Limitations + Known Issues
While this library is likely the closest we've gotten to perfect player motion manipulation, there are some limitations worth mentioning:
- MSPT Inconsistency: Even though the motion applied is constant, the rate at which the server and client update may vary, and calling motion updates per tick may result in inconsistencies when these variations become too large. For consistent results, the library should only be used for instantaneous bursts of motion, and continuous forces should instead rely on riding-based methods or levitation, depending on the context.
If you know any possible solutions or would like to help fixing these problems, please let me know!
评论 0
登录后参与评分
还没有评论,来抢沙发吧