Skip to content

feat(sync): add lightweight explicit block entity sync#17

Merged
QiuYe-123 merged 4 commits into
26.1from
feat/sync-lightweight-network-26.1
Apr 30, 2026
Merged

feat(sync): add lightweight explicit block entity sync#17
QiuYe-123 merged 4 commits into
26.1from
feat/sync-lightweight-network-26.1

Conversation

@QiuYe-123
Copy link
Copy Markdown
Member

What / 目的

本 PR 为方块实体增加显式的轻量网络同步路径,减少网络侧同步相较于字段名 CompoundTag 映射的负担。

Implementation Details / 实现细节

  • 新增专用方块实体同步包:
    • ClientBlockEntitySyncPayload
    • ServerBlockEntitySyncPayload
  • 在模组初始化时注册 payload handler
  • 将客户端缓存值从字符串 key 缓存改为字段对象缓存
  • 复用元数据层预计算的有序字段数组
  • 显式同步包采用更轻量的编码方式:
    • 字段索引
    • 对应字段的 NBT Tag
  • 保留初始/完整同步使用的 getUpdateTag() 路径,不改动全量同步行为
  • 服务端 tick 时向跟踪区块的玩家发送显式更新
  • 客户端改动通过专用 C2S payload 回传服务端
  • 客户端应用显式同步后仍会触发监听器回调和重渲染逻辑

Outcome / 结果

  • 增加了显式 C2S / S2C 方块实体轻量同步链路
  • 保留了现有存档、物品、完整同步行为
  • 去除了显式同步路径中重复的字段筛选工作

Additional Information / 附加信息

已补充 GameTest 覆盖以下场景:

  • 服务端更新应用
  • 客户端网络更新应用
  • 客户端网络更新后的监听器回调触发

Potential Compatibility Issues / 潜在兼容性问题

本 PR 修改了此库自定义显式方块实体同步的网络传输格式。
完整同步和 update tag 相关序列化行为保持不变。

@QiuYe-123 QiuYe-123 self-assigned this Apr 30, 2026
@QiuYe-123 QiuYe-123 requested a review from a team as a code owner April 30, 2026 07:18
@QiuYe-123 QiuYe-123 added Release: Major - 0.X.0 Releases focused on Content, changes to gameplay; While maintaining mostly API stability. type: feature New feature or request bundled for a 0.X.0 Update labels Apr 30, 2026
@github-actions github-actions Bot added 26.1 Tests: Passed Game Tests have passed on this PR labels Apr 30, 2026
@QiuYe-123 QiuYe-123 added the type: tests Test related changes label Apr 30, 2026
@QiuYe-123 QiuYe-123 merged commit f3c337c into 26.1 Apr 30, 2026
4 checks passed
@QiuYe-123 QiuYe-123 deleted the feat/sync-lightweight-network-26.1 branch April 30, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

26.1 Release: Major - 0.X.0 Releases focused on Content, changes to gameplay; While maintaining mostly API stability. Tests: Passed Game Tests have passed on this PR type: feature New feature or request bundled for a 0.X.0 Update type: tests Test related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant