Anti Pie
Anti Pie 是一个服务端插件,用于阻止某些隐藏的方块实体被发送给玩家。这能防止它们在调试饼图中显示出来,从而增加通过饼图定位隐藏基地的难度。
工作原理
- 在数据包发送给客户端之前,从区块数据包中移除选定的方块实体。
- 定期检查隐藏位置,并在它们变为可见时立即发送真实的方块和方块实体数据。
- 使用体素射线检测,并将完整的实心方块计为遮挡物。透明方块和部分方块不会遮挡目标。
性能
大多数数据包仅执行几次简单的类型检查。可见性检查受 visibilityChecksPerPass(默认为 32)限制:玩家移动时每秒四次,静止时每秒一次。当区块首次加载时,每个玩家每刻的可见性检查也限制为 64 次。
每次可见性检查首先测试方块的中心。如有需要,它会检查暴露的面。大多数方块只需要一次射线检测,而最坏情况是 31 次射线检测。隐藏位置以打包长整型存储,以保持内存占用较低。
客户端不运行任何额外代码。初始区块数据包大小相同或更小,因为移除了隐藏的方块实体数据。当隐藏的方块变为可见时,服务器会发送一个替换区块数据包来更新受影响的区块。这会短暂地略微增加带宽使用并导致客户端重建区块,但由于客户端需要处理的方块实体减少,正常游戏通常会更流畅。
配置
Anti Pie 会在其首次启动时在服务器的 config 文件夹中创建一个 anti-pie.json5 文件。
你可以从该文件中:
- 选择哪些方块实体应该被隐藏。
- 更改玩家在多近距离内时,隐藏的方块实体将始终显示。
- 调整可见性检查的频率以及服务器每次执行的工作量,以平衡性能和响应速度。
配置文件使用 JSON5 格式以支持注释,便于阅读和自定义。
许可证
CC0-1.0。代码为原创,但数据包过滤的想法灵感来源于 orbyfied/AntiPieRay。
Anti Pie
Anti Pie is a server-side plugin that stops certain hidden block entities from being sent to players. This keeps them from showing up on the debug pie chart, making it harder to use the pie chart to find hidden bases.
How it works
- Removes selected block entities from chunk packets before they are sent to the client.
- Regularly checks hidden positions and sends the real block and block entity data as soon as they become visible.
- Uses a voxel raycast and counts full solid blocks as blockers. Transparent blocks and partial blocks do not hide a target.
Performance
Most packets only do a few simple type checks. Visibility checks are limited by visibilityChecksPerPass (32 by default): four times per second while a player is moving and once per second while standing still. When chunks first load, visibility checks are also limited to 64 per player each tick.
Each visibility check first tests the center of the block. If needed, it checks the exposed faces. Most blocks only need one raycast, while the worst case is 31 raycasts. Hidden positions are stored as packed longs to keep memory usage low.
The client does not run any extra code. Initial chunk packets are the same size or smaller because hidden block entity data is removed. When a hidden block becomes visible, the server sends one replacement chunk packet for the affected chunk. This can briefly use a little more bandwidth and cause the client to rebuild the chunk, but normal gameplay is usually lighter because the client has fewer block entities to process.
Configuration
Anti Pie creates an anti-pie.json5 file in your server's config folder the first time it starts.
From this file you can:
- Choose which block entities should be hidden.
- Change how close players must be before hidden block entities are always shown.
- Adjust how often visibility checks run and how much work the server does each pass to balance performance and responsiveness.
The config uses the JSON5 format for comments to make it easier to read and customize.
License
CC0-1.0. The code is original, but the packet-filtering idea was inspired by orbyfied/AntiPieRay.
评论 0
登录后参与评分
还没有评论,来抢沙发吧