Skip to content

Fix Bow Lag issue#6249

Open
devcommandyt wants to merge 1 commit intoGeyserMC:masterfrom
devcommandyt:fix/bedrock-bow-arrow-sync
Open

Fix Bow Lag issue#6249
devcommandyt wants to merge 1 commit intoGeyserMC:masterfrom
devcommandyt:fix/bedrock-bow-arrow-sync

Conversation

@devcommandyt
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings March 22, 2026 10:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce perceived “bow lag” by adding a short client-side grace window around the USING_ITEM flag (to avoid stale Java metadata clearing it too early) and by improving projectile (arrow/trident) movement prediction on Bedrock.

Changes:

  • Add a short USING_ITEM prediction/grace window in GeyserSession and clear it on relevant stop-using events.
  • Adjust session player metadata handling to optionally ignore server USING_ITEM=false during the grace window.
  • Make AbstractArrowEntity tick as a projectile (ThrowableEntity) with arrow-appropriate gravity/drag.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java Clears the session’s using-item prediction when the server signals finishing item use.
core/src/main/java/org/geysermc/geyser/session/GeyserSession.java Introduces using-item prediction/grace window logic and item-type detection for prediction.
core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java Attempts to keep USING_ITEM true when receiving server false during the grace window.
core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java Switches arrows to ThrowableEntity ticking and defines arrow gravity/drag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

public boolean shouldIgnoreServerUsingItemFalse() {
return playerEntity.getFlag(EntityFlag.USING_ITEM) && System.currentTimeMillis() < usingItemPredictionUntil;
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldIgnoreServerUsingItemFalse() checks playerEntity.getFlag(EntityFlag.USING_ITEM), but SessionPlayerEntity#setLivingEntityFlags calls this after super.setLivingEntityFlags(entityMetadata) has already applied the server value (clearing USING_ITEM when the stale metadata is false). That makes this method return false in the exact scenario it's meant to handle, so the stale USING_ITEM=false update will not be ignored.

Consider basing this purely on the prediction window (e.g., System.currentTimeMillis() < usingItemPredictionUntil) and/or tracking a separate “prediction active” boolean that isn't overwritten by the server metadata application.

Suggested change
return playerEntity.getFlag(EntityFlag.USING_ITEM) && System.currentTimeMillis() < usingItemPredictionUntil;
return System.currentTimeMillis() < usingItemPredictionUntil;

Copilot uses AI. Check for mistakes.
@onebeastchris onebeastchris added the PR: Bugfix When a PR contains a bugfix label Mar 23, 2026
@onebeastchris
Copy link
Copy Markdown
Member

Hello! Thank you for the contribution. The gravity/drag values and the inheritance changes look good to me, but I'm a bit confused on the need for the ITEM_USE fix - can you elaborate on it?

Thanks!

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

Labels

PR: Bugfix When a PR contains a bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants