-
Notifications
You must be signed in to change notification settings - Fork 0
Network Sync Protocol
To guarantee seamless client-side inventory interaction without requiring server restarts or player reconnects when GameRules change, Stack Size Adjuster implements a custom Fabric networking payload StackSizeLimitSyncPayload.
-
Payload Identifier:
stack-size-adjuster:sync_limit - Direction: Server to Client (S2C)
-
Execution: Triggered on
ServerPlayConnectionEvents.JOINand wheneverStackSizeManager.setLimitsis called on the server.
public record StackSizeLimitSyncPayload(int limit64, int limit16, int limit1) implements CustomPacketPayload {
public static final CustomPacketPayload.Type<StackSizeLimitSyncPayload> TYPE = new CustomPacketPayload.Type<>(
Identifier.fromNamespaceAndPath("stack-size-adjuster", "sync_limit")
);
public static final StreamCodec<RegistryFriendlyByteBuf, StackSizeLimitSyncPayload> CODEC = StreamCodec.composite(
ByteBufCodecs.VAR_INT, StackSizeLimitSyncPayload::limit64,
ByteBufCodecs.VAR_INT, StackSizeLimitSyncPayload::limit16,
ByteBufCodecs.VAR_INT, StackSizeLimitSyncPayload::limit1,
StackSizeLimitSyncPayload::new
);
@Override
public Type<? extends CustomPacketPayload> type() {
return TYPE;
}
}[ Server GameRule Update ] ---> [ StackSizeManager.setLimits ]
|
v
[ Send StackSizeLimitSyncPayload ]
|
v
[ Client ClientPlayNetworking ] <-------------+
|
v
[ StackSizeManager.setClientLimits ]
|
v
[ Force Menu Refresh: broadcastFullState() ]
When the server updates limits, StackSizeManager.setLimits iterates over all online players:
for (ServerPlayer player : server.getPlayerList().getPlayers()) {
ServerPlayNetworking.send(player, payload);
if (player.containerMenu != null) {
player.containerMenu.broadcastFullState();
}
if (player.inventoryMenu != null && player.containerMenu != player.inventoryMenu) {
player.inventoryMenu.broadcastFullState();
}
}This forces the client's inventory and open container menus to refresh stack limits in real-time.
๐ Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
Copyright ยฉ 2026 Dasik (Rifaditya). Licensed under the GNU General Public License v3.0 (GPLv3).
๐ Home
- Dynamic GameRules
- Category Stack Limits
- Container Drop Optim.
- Large Chest Overflow
- ModMenu & YACL Config
- Item Count Rendering
- Item Clumps Synergies
- Troubleshooting & FAQ
- Developer Setup
- Architecture Layout
- Mixin Reference
- Addon Override API
- Network Sync Protocol
- Give Command Handling
- Behavior Profiles
- Consumer Mods Guide
- Performance Impact
- Advancements Matrix
- Author: Dasik (Rifaditya)
- License: GPL-3.0-or-later