同步区块状态
模组化多服务器设置可能……相当复杂。
当你拥有多个连接的服务器,且每个服务器的模组列表都不同时,不同服务器之间存在区块不匹配的情况并不少见,从而导致你看到类似这样的画面:

显然这并不理想,因此本模组采取的方法是:当玩家加入时,将所有区块状态从服务器端同步到客户端,使客户端能够进行补偿。
例如,启用区块状态同步后的同一张截图:

注意:如果客户端未能从服务器接收到区块状态信息,它将回退使用原版状态。
本模组仍处于 W.I.P.(开发中)阶段,还有许多改进空间,但它应该目前能正常工作。
配置
在现阶段缺乏正式配置文件的情况下,Synchronised Blockstates 提供了多种行为,可通过 JVM 参数或环境变量启用或自定义:
-
-Dmod.synchronisedblockstates.dumpAllStates
- 仅限客户端。
- 接受的值:
true、1、yes、on。
- 在游戏启动时,会将所有方块状态编码(使用与发送单个未分块的状态注册表数据包相同的格式),并将其写入
<minecraft 运行目录>/synchronized_blockstates/vanillablockstates.dat(注意:不一定是仅原版方块状态,如果存在模组方块,也将包含模组方块状态)。
-
-Dmod.synchronisedblockstates.ouputMissingStates
- 仅客户端。
- 接受的值为:
true、1、yes、on。
- 当客户端接收到数据包并重新映射其本地注册表时,会将客户端与服务端注册表之间的任何不匹配项输出到
<minecraft run directory>/synchronized_blockstates/missing-states-<当前时间>.dat
-
-Dmod.synchronisedblockstates.propertyChunkingThreshold
- 仅逻辑服务器。
- 接受的值:任意整数,默认值为
1024。
- 在服务器向客户端发送数据之前开始对数据进行分块处理之前的属性最大限制。此外,这也是单个属性块中可以发送的最大属性数量。
-
-Dmod.synchronisedblockstates.blockChunkingThreshold
- 仅逻辑服务器。
- 接受的值:任意整数,默认值为
4096。
- 在服务器开始对数据分块并发送给客户端之前,区块中允许的最大方块数量限制。此外,这也是单个方块状态分块中可以发送的最大方块数量。
-
-Dmod.synchronisedblockstates.stateChunkingThreshold
- 仅限逻辑服务器。
- 接受的值:任意整数,默认值为
32768。
- 在服务器向客户端发送数据之前开始对区块数据进行分块处理之前的方块状态最大限制。
Synchronised Blockstates
Modded multiserver setups can be... complicated.
When you have multiple connected servers that all have different modlists, it's not uncommon for different servers to have mismatched blocks, leaving you with sights like this:

Obviously this isn't ideal, so this mod takes the approach of synchronising all of the blockstates from the server to the client side when the player joins, allowing the client to compensate.
For example, that same image with synchronised blockstates enabled:

Note: if the client doesn't receive blockstate info from the server, it'll fall back to using vanilla states.
This mod is still a W.I.P. and there are plenty of improvements yet to be made, but it should function for the time being.
Configuration
In lieu of a proper config at this point in time, Synchronised Blockstates has several behaviours that can be enabled or customised using JVM arguments or environment variables:
-
-Dmod.synchronisedblockstates.dumpAllStates
- Client-only.
- Accepted values:
true, 1, yes, on.
- On startup, encodes all blockstates (using the same format as if it were sending a single, unchunked, state registry packet) and writes it to
<minecraft run directory>/synchronized_blockstates/vanillablockstates.dat (note: not necessarily only vanilla blockstates, will also include modded blockstates if there are any modded blocks).
-
-Dmod.synchronisedblockstates.ouputMissingStates
- Client-only.
- Accepted values:
true, 1, yes, on.
- When the client recieves a packet and remaps its local registry, outputs any mismatches between the client and server registries to
<minecraft run directory>/synchronized_blockstates/missing-states-<current time>.dat
-
-Dmod.synchronisedblockstates.propertyChunkingThreshold
- Logical Server only.
- Accepted values: any integer, default
1024.
- Max limit on properties before the server starts chunking data before sending it to the client. Additionally, the maximum number of properties that can be sent in a single property chunk.
-
-Dmod.synchronisedblockstates.blockChunkingThreshold
- Logical Server only.
- Accepted values: any integer, default
4096.
- Max limit on blocks before the server starts chunking data before sending it to the client. Additionally, the maximum number of blocks there can be sent in a single blockstate chunk.
-
-Dmod.synchronisedblockstates.stateChunkingThreshold
- Logical Server only.
- Accepted values: any integer, default
32768.
- Max limit on blockstates before the server starts chunking data before sending it to the client.
评论 0
登录后参与评分
还没有评论,来抢沙发吧