Skip to content

[Optimize] Add options to reduce unnecessary packets#675

Open
VeVeVeVel wants to merge 3 commits intoWinds-Studio:ver/1.21.11from
VeVeVeVel:opt/Filter-ClientboundSetEntityMotionPacket
Open

[Optimize] Add options to reduce unnecessary packets#675
VeVeVeVel wants to merge 3 commits intoWinds-Studio:ver/1.21.11from
VeVeVeVel:opt/Filter-ClientboundSetEntityMotionPacket

Conversation

@VeVeVeVel
Copy link
Contributor

Description

This PR applies an optimization patch from the Canvas project to Leaf. It introduces a rough filter for ClientboundSetEntityMotionPacket, which can reduce bandwidth usage by up to 60%.
https://github.com/CraftCanvasMC/Canvas/blob/ver/1.21.11/canvas-server/minecraft-patches/sources/net/minecraft/server/level/ServerEntity.java.patch

While entirely disabling this packet causes major desync issues, this patch carefully filters the packets while retaining them for specific entities that rely on them for smooth visual gameplay.

Implementation Details

The packet is filtered out by default when the ReduceUselessPackets.filterClientboundSetEntityMotionPacket config is enabled, except for the following entities:

  1. Squids: Required as they are mobs with a 360° range of rotation.
  2. Item Entities: Disabling this causes glitches and client-side desyncs (often within 0.5 blocks). Packets are only sent if the item has actually moved (flag1).
  3. Ender Eyes: The client does not have access to the Stronghold structure data to calculate velocity on its own, so it relies on the server sending the velocity via this packet.
  4. Shulker Bullets: Since their trajectory uses randomness, we must send velocity packets to ensure their movement remains smooth on the client.

Credits

@Dreeam-qwq Dreeam-qwq added type: optimization Pull request for optimization status: docs update required Config changed, needs the PR author or team member to update docs labels Mar 18, 2026
@VeVeVeVel VeVeVeVel changed the title [Optimize] Port Canvas patch to filter ClientboundSetEntityMotionPacket [Optimize] Add options to reduce unnecessary packets Mar 18, 2026
@VeVeVeVel
Copy link
Contributor Author

VeVeVeVel commented Mar 18, 2026

Description

This PR adds the disable-useless-particles configuration to reduce unnecessary network traffic and server load.

About Disable Useless Particles:
This feature disables the server-side logic for the following cosmetic particles:

  • Sprint Particles
  • Death Particles
  • Effect Particles
  • Water Splash Particles
  • Bubble Column Particles

As noted by the original developer of this patch:

"It is recommended to enable these options, as the client displays most of these particles already, so the server-side particle logic is not needed."
CraftCanvasMC/Canvas@f43bf76
https://github.com/CraftCanvasMC/Canvas/blob/ver/1.21.11/canvas-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch
https://github.com/CraftCanvasMC/Canvas/blob/ver/1.21.11/canvas-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch

By disabling this unneeded server-side logic, we can effectively save network bandwidth, all while maintaining the exact same visual experience for players.

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: docs update required Config changed, needs the PR author or team member to update docs type: optimization Pull request for optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants