[GH-ISSUE #7253] Expired status effect lingers with duration: 0 for 1 tick before removal #3185

Open
opened 2026-11-03 04:06:31 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @byMehd on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7253

🤖 Opened by Gemini (Gemini 3.8 Flash High), an AI agent, not directly by @byMehd.

Environment

  • Operating System: Windows 11 Home (x86_64)
  • Horizon Version: Nightly 2026-11-01 (nightly-2026-11-01-c9d474d) via official Horizon Launcher
  • Vanilla Reference: Minecraft: Java Edition 26.3 (server-game.jar / client.jar)

Summary

When a status effect's remaining duration reaches 0 ticks, it lingers in the active effects list for 1 additional tick with duration: 0 before being purged. In vanilla Minecraft: Java Edition 26.3, expired effects are removed immediately in the tick they expire.

Steps to Reproduce

  1. Start Horizon on Windows.
  2. Grant any status effect with a specific duration (for example: /effect give @s speed 10 0 = 200 ticks).
  3. Query the entity's active effects at the moment of expiration (tick 200 / tick 201).

Observed Behavior (Horizon Nightly 2026-11-01)

  • At the expiration tick, the effect remains present in the active effects list with:
    {"id": "speed", "duration": 0, "amplifier": 0}
  • It persists for 1 tick with duration: 0 before being cleaned up in the subsequent tick cycle.

Expected Behavior (Vanilla Minecraft: Java Edition 26.3)

  • In vanilla LivingEntity.tickEffects(), when an active MobEffectInstance decrements to duration <= 0, it is removed during that exact tick.
  • An entity query never returns an active status effect instance whose duration is 0 or negative.
Originally created by @byMehd on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7253 > 🤖 Opened by Gemini (Gemini 3.8 Flash High), an AI agent, not directly by @byMehd. ### Environment - **Operating System:** Windows 11 Home (x86_64) - **Horizon Version:** Nightly 2026-11-01 (`nightly-2026-11-01-c9d474d`) via official Horizon Launcher - **Vanilla Reference:** Minecraft: Java Edition 26.3 (`server-game.jar` / `client.jar`) ### Summary When a status effect's remaining duration reaches 0 ticks, it lingers in the active effects list for 1 additional tick with `duration: 0` before being purged. In vanilla Minecraft: Java Edition 26.3, expired effects are removed immediately in the tick they expire. ### Steps to Reproduce 1. Start Horizon on Windows. 2. Grant any status effect with a specific duration (for example: `/effect give @s speed 10 0` = 200 ticks). 3. Query the entity's active effects at the moment of expiration (tick 200 / tick 201). ### Observed Behavior (Horizon Nightly 2026-11-01) - At the expiration tick, the effect remains present in the active effects list with: `{"id": "speed", "duration": 0, "amplifier": 0}` - It persists for 1 tick with `duration: 0` before being cleaned up in the subsequent tick cycle. ### Expected Behavior (Vanilla Minecraft: Java Edition 26.3) - In vanilla `LivingEntity.tickEffects()`, when an active `MobEffectInstance` decrements to `duration <= 0`, it is removed during that exact tick. - An entity query never returns an active status effect instance whose duration is 0 or negative.
Author
Owner

@byMehd commented on GitHub (Nov 2, 2026):

Detailed Telemetry from Isolated Retest

In an isolated retest measuring the lifecycle of speed (3 seconds / 60 ticks) tick-by-tick:

  • At tick 50: duration: 9
  • At tick 51: duration: 7
  • At tick 52: duration: 5
  • At tick 53: duration: 3
  • At tick 54: duration: 1
  • At tick 55: duration: 0
  • From tick 55 through tick 69+ (15+ consecutive ticks): the effect remains present in active effects with {'amplifier': 0, 'duration': 0, 'id': 'speed'}.

In vanilla Minecraft: Java Edition 26.3 (LivingEntity.tickEffects()), an effect whose duration reaches <= 0 is pruned from ctiveEffects immediately within the same tick. In Horizon, it persists at duration: 0 indefinitely / across many ticks.

<!-- gh-comment-id:6578855332 --> @byMehd commented on GitHub (Nov 2, 2026): ### Detailed Telemetry from Isolated Retest In an isolated retest measuring the lifecycle of speed (3 seconds / 60 ticks) tick-by-tick: - At tick 50: duration: 9 - At tick 51: duration: 7 - At tick 52: duration: 5 - At tick 53: duration: 3 - At tick 54: duration: 1 - At tick 55: duration: 0 - From tick 55 through tick 69+ (15+ consecutive ticks): the effect remains present in active effects with {'amplifier': 0, 'duration': 0, 'id': 'speed'}. In vanilla Minecraft: Java Edition 26.3 (LivingEntity.tickEffects()), an effect whose duration reaches <= 0 is pruned from ctiveEffects immediately within the same tick. In Horizon, it persists at duration: 0 indefinitely / across many ticks.
Author
Owner

@breachato commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6579751523 --> @breachato commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Author
Owner

@breachato commented on GitHub (Nov 2, 2026):

🤖 Agent: comment by breachato's AI agent (Claude Code, Claude Opus 5.5), not by breachato personally.

Releasing this. It needs a run in game, which I can't do here. Notes from reading main (fdd290b99b) for whoever takes it:

  • The server side already drops an effect the tick it runs out. PlayerEffects::tick_with (horizon-client-render/src/effects.rs) ticks the effect down and removes it as soon as the duration isn't positive, as MobEffectInstance.tickServer returning false does. LanHub::sync_effects then sends RemoveMobEffect for every id that is in sent_effects but no longer in the list.
  • A duration: 0 entry that stays for 15+ ticks is the client's copy. tick_client (MobEffectInstance.tickClient) stops counting at 0 and leaves removal to the server. So the client's list keeps duration: 0 until a RemoveMobEffect arrives, which means that packet either isn't sent or isn't applied for this player. effects_json reads that client copy.
  • The telemetry counts down by 2 per tick (9, 7, 5, 3, 1), so the client copy is probably ticked twice a tick, or overwritten by UpdateMobEffect resends. That points to the client path (tick_client_effects in remote.rs) or to sync_effects resending each tick (e.duration != expected).

A good first check: log RemoveMobEffect on both sides around the expiry tick.

/unclaim

<!-- gh-comment-id:6579805006 --> @breachato commented on GitHub (Nov 2, 2026): 🤖 Agent: comment by breachato's AI agent (Claude Code, Claude Opus 5.5), not by breachato personally. Releasing this. It needs a run in game, which I can't do here. Notes from reading main (`fdd290b99b`) for whoever takes it: - **The server side already drops an effect the tick it runs out.** `PlayerEffects::tick_with` (`horizon-client-render/src/effects.rs`) ticks the effect down and removes it as soon as the duration isn't positive, as `MobEffectInstance.tickServer` returning false does. `LanHub::sync_effects` then sends `RemoveMobEffect` for every id that is in `sent_effects` but no longer in the list. - **A `duration: 0` entry that stays for 15+ ticks is the client's copy.** `tick_client` (`MobEffectInstance.tickClient`) stops counting at 0 and leaves removal to the server. So the client's list keeps `duration: 0` until a `RemoveMobEffect` arrives, which means that packet either isn't sent or isn't applied for this player. `effects_json` reads that client copy. - **The telemetry counts down by 2 per tick** (9, 7, 5, 3, 1), so the client copy is probably ticked twice a tick, or overwritten by `UpdateMobEffect` resends. That points to the client path (`tick_client_effects` in `remote.rs`) or to `sync_effects` resending each tick (`e.duration != expected`). A good first check: log `RemoveMobEffect` on both sides around the expiry tick. /unclaim
Author
Owner

@breachato commented on GitHub (Nov 2, 2026):

🤖 Agent: /unclaim

<!-- gh-comment-id:6579805842 --> @breachato commented on GitHub (Nov 2, 2026): 🤖 Agent: /unclaim
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, This issue is closed. (asked by @breachato)

<!-- gh-comment-id:6579838908 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, This issue is closed. (asked by @breachato)
Author
Owner

@breachato commented on GitHub (Nov 2, 2026):

🤖 Agent: /unclaim

<!-- gh-comment-id:6579917401 --> @breachato commented on GitHub (Nov 2, 2026): 🤖 Agent: /unclaim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3185
No description provided.