隐藏坐标
一个用于 Fabric 的服务端模组,用于阻止向客户端发送真实坐标。基于并部分复制自 Spigot 版本的 CoordinateOffset,原作者为 Joshua Prince。
同时感谢 Patbox 提供了我从 Polymer 中使用的一小部分代码。
功能
- 玩家的坐标会被偏移,使得他们进入当前世界(加入、传送、通过传送门或重生)的位置在他们看来是 0, 0。
- 管理员可以使用
/coordoffset get 查看自己的偏移量。
- 管理员可以使用
/coordoffset set [pos] 更改自己的偏移量,使得指定的位置对他们来说位于 0,0 区块,或者使用 /coordoffset set none 来禁用偏移。
- 只有当玩家能够看到时,世界边界墙才会发送给玩家。这是为了防止客户端模组利用世界边界中心信息瞬间计算出偏移量。
为什么?
游戏内规则 reducedDebugInfo 会从调试屏幕中隐藏坐标,但这可以很容易地通过客户端模组绕过。此模组通过偏移所有发送给客户端的坐标来真正隐藏坐标。
希望在不依赖荣誉制度的情况下真正强制执行 reducedDebugInfo 规则的服务器需要像这样的模组。这是我的实现尝试 :)
免责声明
我是一个新晋的模组开发者。我需要它用于我正在开发的服务器,并将其作为一个学习机会制作而成。因此,该模组并不具备所有功能,代码相当杂乱,可能存在错误或崩溃问题。但我仍然认为它对其他人可能有用。请随意使用代码,欢迎提供改进建议!
已知问题:
- 与 CoordinateOffset 相比,这里缺少的主要功能是大量的配置选项。偏移量始终设置为你在 0,0 区块出生,并在死亡和维度切换时重置。
- 世界边界的扩大或缩小看起来非常奇怪。
- 有可能我遗漏了一些需要偏移的数据包,请告诉我!
Hide Coordinates
Server-side Fabric mod to prevent sending real coordinates to the client. Based on and partly copied from the Spigot version CoordinateOffset by Joshua Prince.
Credit also goes to Patbox for a small sample of code I used from Polymer!
Features
- Players' coordinates are offset so that the location they entered the current world (join, teleport, portal or respawn) is shown to them as 0, 0.
- Admins can use
/coordoffset get to find their own offset.
- Admins can use
/coordoffset set [pos] to change their own offset such that the specified pos is in the 0,0 chunk for them, or /coordoffset set none to disable the offset.
- Any worldborder wall is only sent to players who can see it. This is to prevent client-side mods from instantly figuring out the offset from world border center information.
Why?
The gamerule reducedDebugInfo hides coordinates from the debug screen, but this can be easily circumvented using a client-side mod. This mod hides the coordinates for real by offsetting all coordinates sent to the client.
A server that wants to actually enforce the gamerule reducedDebugInfo without an honour system will need a mod like this. This is my attempt at an implementation :)
Disclaimer
I'm a new modder. I needed this for a server I'm working on and made it as a learning opportunity. Therefore the mod doesn't have all the features, the code is quite messy, and there could be bugs or crashes. But I still figured it might be useful to some others. Feel free to use the code as you please, and improvement suggestions are welcome!
Known issues:
- The main feature missing here from CoordinateOffset are the vast configuration options. Offsets are always set so you spawn in chunk 0,0 and this resets on death and dimension change.
- Worldborder growing or shrinking looks really weird.
- It's possible that I missed some packets that need the offset, let me know!
评论 0
登录后参与评分
还没有评论,来抢沙发吧