[PR #7425] [MERGED] use_item_on: a clicked dragon egg teleports #7592

Closed
opened 2026-11-03 07:20:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7425
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: test/dragon-egg


📝 Commits (2)

📊 Changes

1 file changed (+35 additions, -2 deletions)

View changed files

📝 tools/test_use_item_on_parity.py (+35 -2)

📄 Description

A right click on a dragon egg never uses the item in the hand: DragonEggBlock.useWithoutItem calls
teleport, which draws nextInt(16) - nextInt(16), nextInt(8) - nextInt(8) and
nextInt(16) - nextInt(16) from the level random up to 1000 times and takes the first offset that lands
on air, inside the build height, whose block below is not air; there it sends level event 2015 with
BlockUtil.packDifferenceInPosition(pos, dest, 16, 8, 16), sets the egg, and removes the clicked one. A
click that finds no such spot leaves the egg where it is, having spent 6000 random draws on the search.

Horizon already does this (Behaviours::use_without_item -> dragon_egg_teleport in
crates/horizon-world/src/level/interact.rs); nothing pinned it - dragon_egg appeared in no harness.
The case is dragon_egg_case in tools/test_use_item_on_parity.py: an egg at the origin, usually on a
random floor of stone/dirt/planks/glass/snow/gravel that reaches two blocks out, sometimes a block above
it, clicked with an empty hand or a stick, torch, stone or another egg, survival or creative, sneaking or
not. 160 of the run's 4000 cases are eggs: 117 find a spot (level event 2015, the egg set at the
destination, air where it was), 43 have nowhere to land (the block above it fills the only cell whose
block below is not air, and no floor is under it), so the egg stays and the whole search is spent.

Proven:

  • python3 tools/parity.py use_item_on with the new dragon_egg_case: PASS use_item_on,
    1 passed, 0 failed in 8.9 min. (probes built in 489s, then the harness's own 532s that built the
    client in a fresh worktree); the harness's own line is 4000/4000 cases match (0 oracle errors); vanilla planted in 660, started eating in 376, exploded 356 times and found a respawn spot in 354.
    All 160 dragon egg cases matched, and 117 of them ended with vanilla's L 2015 and a moved egg.
  • With the Class::DragonEgg arm removed from use_without_item, the same harness failed:
    3856/4000 cases match, 144 differing, all dragon eggs - empty hand on dragon_egg: 53 differing,
    torch on dragon_egg: 29, stone on dragon_egg: 23, dragon_egg on dragon_egg: 21,
    stick on dragon_egg: 18. Vanilla ends with L 2015 0,0,0 1050642 | set 0,0,0 0 | set 0,0,2 11212
    (state 11212 is minecraft:dragon_egg: the egg gone from the origin, two blocks south of it) while
    Horizon sends no level event, changes no block and leaves the egg at 0,0,0; the final level random
    differs in every one of those cases, including the ones where vanilla's search finds nothing. With an
    egg in the hand the removed arm also shows the click falling through to the item:
    set 0,1,0 11212, stat minecraft:dragon_egg minecraft:used 1 and 15 left. The 16 egg cases that
    still match are sneaking clicks with something in the hand, which are spent on the item either way.

Not proven: nothing in a real client; the harness runs the game headlessly. The in-game check is the
case itself: click a dragon egg and watch it jump to a spot with floor under it a few blocks away, with
the held item still in hand.


🔄 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/7425 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `test/dragon-egg` --- ### 📝 Commits (2) - [`69808d0`](https://github.com/horizon-rust/horizon/commit/69808d0fc43b365eda44e999bb8d3ea83ee98707) use_item_on: a clicked dragon egg teleports - [`66f5d2e`](https://github.com/horizon-rust/horizon/commit/66f5d2ed9bbb39a428f69d1e6c275e9453833a8f) Merge main into #7425 ### 📊 Changes **1 file changed** (+35 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_use_item_on_parity.py` (+35 -2) </details> ### 📄 Description A right click on a dragon egg never uses the item in the hand: `DragonEggBlock.useWithoutItem` calls `teleport`, which draws `nextInt(16) - nextInt(16)`, `nextInt(8) - nextInt(8)` and `nextInt(16) - nextInt(16)` from the level random up to 1000 times and takes the first offset that lands on air, inside the build height, whose block below is not air; there it sends level event 2015 with `BlockUtil.packDifferenceInPosition(pos, dest, 16, 8, 16)`, sets the egg, and removes the clicked one. A click that finds no such spot leaves the egg where it is, having spent 6000 random draws on the search. Horizon already does this (`Behaviours::use_without_item` -> `dragon_egg_teleport` in `crates/horizon-world/src/level/interact.rs`); nothing pinned it - `dragon_egg` appeared in no harness. The case is `dragon_egg_case` in `tools/test_use_item_on_parity.py`: an egg at the origin, usually on a random floor of stone/dirt/planks/glass/snow/gravel that reaches two blocks out, sometimes a block above it, clicked with an empty hand or a stick, torch, stone or another egg, survival or creative, sneaking or not. 160 of the run's 4000 cases are eggs: 117 find a spot (level event 2015, the egg set at the destination, air where it was), 43 have nowhere to land (the block above it fills the only cell whose block below is not air, and no floor is under it), so the egg stays and the whole search is spent. **Proven:** - `python3 tools/parity.py use_item_on` with the new `dragon_egg_case`: `PASS use_item_on`, `1 passed, 0 failed in 8.9 min.` (probes built in 489s, then the harness's own 532s that built the client in a fresh worktree); the harness's own line is `4000/4000 cases match (0 oracle errors); vanilla planted in 660, started eating in 376, exploded 356 times and found a respawn spot in 354`. All 160 dragon egg cases matched, and 117 of them ended with vanilla's `L 2015` and a moved egg. - With the `Class::DragonEgg` arm removed from `use_without_item`, the same harness failed: `3856/4000 cases match`, 144 differing, all dragon eggs - `empty hand on dragon_egg: 53 differing`, `torch on dragon_egg: 29`, `stone on dragon_egg: 23`, `dragon_egg on dragon_egg: 21`, `stick on dragon_egg: 18`. Vanilla ends with `L 2015 0,0,0 1050642 | set 0,0,0 0 | set 0,0,2 11212` (state 11212 is `minecraft:dragon_egg`: the egg gone from the origin, two blocks south of it) while Horizon sends no level event, changes no block and leaves the egg at `0,0,0`; the final level random differs in every one of those cases, including the ones where vanilla's search finds nothing. With an egg in the hand the removed arm also shows the click falling through to the item: `set 0,1,0 11212`, `stat minecraft:dragon_egg minecraft:used 1` and 15 left. The 16 egg cases that still match are sneaking clicks with something in the hand, which are spent on the item either way. **Not proven:** nothing in a real client; the harness runs the game headlessly. The in-game check is the case itself: click a dragon egg and watch it jump to a spot with floor under it a few blocks away, with the held item still in hand. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:20:27 +07:00
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#7592
No description provided.