Conversation
There was a problem hiding this comment.
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_ITEMprediction/grace window inGeyserSessionand clear it on relevant stop-using events. - Adjust session player metadata handling to optionally ignore server
USING_ITEM=falseduring the grace window. - Make
AbstractArrowEntitytick 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; |
There was a problem hiding this comment.
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.
| return playerEntity.getFlag(EntityFlag.USING_ITEM) && System.currentTimeMillis() < usingItemPredictionUntil; | |
| return System.currentTimeMillis() < usingItemPredictionUntil; |
|
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! |
No description provided.