[PR #7570] Preserve signed item pickup delays and infinite sentinel #7680

Open
opened 2026-11-03 07:21:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7570
Author: @TheMrZZ
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/item-pickup-delay


📝 Commits (2)

  • 57f7ac6 Preserve signed item pickup delays and infinite sentinel
  • 93c6382 Merge main into item pickup-delay fix

📊 Changes

5 files changed (+141 additions, -13 deletions)

View changed files

📝 crates/horizon-client/src/entities.rs (+15 -9)
📝 crates/horizon-client/src/entity_nbt.rs (+102 -2)
📝 crates/horizon-client/src/game.rs (+1 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+2 -1)
📝 tools/command_exec_corpus.py (+21 -0)

📄 Description

🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally.

What and why

Fixes #7556. An item loaded with PickupDelay:-1s now retains -1, and PickupDelay:32767s stays infinite instead of counting down to 32766. Ordinary positive delays still decrement to zero. Signed Age and its -32768 sentinel were already fixed by 75c640c9a; this PR retains those behaviors as controls.

Use signed counter storage wide enough to retain the legacy internal u32::MAX infinite-delay value. Both infinite representations remain excluded from merging. Existing unsigned spawn inputs and the native hook's unsigned snapshot field keep their representation, including projecting negative counters to zero in that snapshot.

The resource-backed regression loads item NBT, runs actual item ticks, and checks counters and lifetime across seven ages and five delays. It fails on the old code at delay 32767 after one tick (32766), and passes with this fix, including the legacy internal sentinel. The native command corpus adds 490 observations with isolated items and direct existence/counter queries.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Java 26.3 ItemEntity.tick decrements pickupDelay only when it is positive and not 32767. Negative delays remain negative. Age increments unless -32768, and items expire at age >=6000. The native corpus covers ages -32768, -1, 0, 5998, 5999, 6000 and 32767, delays -1, 0, 1, 2 and 32767, and ticks 0..3 after applying the NBT.

PR #7471 routes loading through the entity trait without fixing these counters. This change retains the existing loader entry point. No general pickup, merging or save/reload parity claim. The focused native Game command corpus now matches fresh official Java 26.3 on 490/490 observations.

Other projects' code

None.

Self-check

pr_ready (tools/pr_ready.py --quick on a local runner, against origin/main at 31f83499b, 8 min 5 s)

Check Result
Scope ✅ 5 files, +141 −13
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (41 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 36 s)
tests: horizon-client, horizon-client-lib ✅ 2208 passed (5 min 29 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
mod API up to date ✅ (10 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The focused loaded_item_lifetime_counters_tick_with_signed_sentinels test ran with prepared loader resources (not skipped): old source fails at tick 1 with 32766 instead of 32767; fixed source passes.

🤖 Generated with Codex.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7570 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/item-pickup-delay` --- ### 📝 Commits (2) - [`57f7ac6`](https://github.com/horizon-rust/horizon/commit/57f7ac675b2ac9f4afd23f780b53425cd6c83e16) Preserve signed item pickup delays and infinite sentinel - [`93c6382`](https://github.com/horizon-rust/horizon/commit/93c63826da8fe11ba6680515e168fcffcf732fc6) Merge main into item pickup-delay fix ### 📊 Changes **5 files changed** (+141 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entities.rs` (+15 -9) 📝 `crates/horizon-client/src/entity_nbt.rs` (+102 -2) 📝 `crates/horizon-client/src/game.rs` (+1 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+2 -1) 📝 `tools/command_exec_corpus.py` (+21 -0) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Fixes #7556. An item loaded with `PickupDelay:-1s` now retains -1, and `PickupDelay:32767s` stays infinite instead of counting down to 32766. Ordinary positive delays still decrement to zero. Signed Age and its -32768 sentinel were already fixed by 75c640c9a; this PR retains those behaviors as controls. Use signed counter storage wide enough to retain the legacy internal `u32::MAX` infinite-delay value. Both infinite representations remain excluded from merging. Existing unsigned spawn inputs and the native hook's unsigned snapshot field keep their representation, including projecting negative counters to zero in that snapshot. The resource-backed regression loads item NBT, runs actual item ticks, and checks counters and lifetime across seven ages and five delays. It fails on the old code at delay 32767 after one tick (32766), and passes with this fix, including the legacy internal sentinel. The native command corpus adds 490 observations with isolated items and direct existence/counter queries. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference Java 26.3 `ItemEntity.tick` decrements pickupDelay only when it is positive and not 32767. Negative delays remain negative. Age increments unless -32768, and items expire at age >=6000. The native corpus covers ages -32768, -1, 0, 5998, 5999, 6000 and 32767, delays -1, 0, 1, 2 and 32767, and ticks 0..3 after applying the NBT. PR #7471 routes loading through the entity trait without fixing these counters. This change retains the existing loader entry point. No general pickup, merging or save/reload parity claim. The focused native Game command corpus now matches fresh official Java 26.3 on **490/490 observations**. ## Other projects' code None. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on a local runner, against origin/main at 31f83499b, 8 min 5 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +141 −13 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (41 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 36 s) | | tests: horizon-client, horizon-client-lib | ✅ 2208 passed (5 min 29 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (10 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The focused `loaded_item_lifetime_counters_tick_with_signed_sentinels` test ran with prepared loader resources (not skipped): old source fails at tick 1 with 32766 instead of 32767; fixed source passes. 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7680
No description provided.