[PR #7449] [MERGED] use_item_on: doors, trapdoors and fence gates opened by hand #7610

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

📋 Pull Request Information

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

Base: main ← Head: test/openable-blocks


📝 Commits (5)

  • 69808d0 use_item_on: a clicked dragon egg teleports
  • 97712ec use_item_on: doors, trapdoors and fence gates opened by hand
  • 66f5d2e Merge main into #7425
  • ae52503 Merge #7425 and main into #7449
  • ef6cc9f use_item_on: the openable and dragon egg branches each keep their own tail

📊 Changes

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

View changed files

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

📄 Description

A hand opens a door, a trapdoor and a fence gate, and the three vanilla behaviours agree on the shape of
it: DoorBlock.useWithoutItem returns PASS when the material's BlockSetType.canOpenByHand() is false,
otherwise cycles open, setBlock(pos, state, 10), plays the open or close sound and sends
block_open/block_close; TrapDoorBlock.useWithoutItem does the same through toggle, which uses
flags 2, reschedules the water when the trapdoor is waterlogged and plays the sound through playSound;
FenceGateBlock.useWithoutItem closes a gate that is open, and opening one that faces the player turns
its facing to player.getDirection() first and draws its sound pitch from
level.getRandom().nextFloat() * 0.1F + 0.9F. A pass leaves the click to the item, so a block in the
hand is placed against the iron door instead.

Horizon has all three arms (Behaviours::use_without_item in crates/horizon-world/src/level/interact.rs),
but no harness case clicked an openable block: the harnesses that mention doors, trapdoors, levers and
buttons (test_redstone_parity.py, test_breaking_model_parity.py) only power them, and
test_use_item_on_parity.py used oak_trapdoor as scenery around a respawn anchor.

The case is openable_case in tools/test_use_item_on_parity.py: a door (both halves, random facing,
hinge, open and powered), a trapdoor (random facing, half, open, powered, waterlogged) or a fence gate
(random facing, open, powered, in_wall) of every material, clicked on its own or the opposite face or
the top/bottom one, by a player turned to one of twelve yaws, holding nothing or a stick, block, ingot,
door or gate, survival or creative, sneaking or not. 152 of the run's 4000 cases are openable blocks (58
doors, 43 trapdoors, 51 fence gates): 119 change the clicked block, 48 of those move the door's second
half with it, 39 fence gates turn to face the player as they open, 4 iron ones pass so the held block is
placed instead, and the sneaking clicks with something in the hand place that block.

Proven:

  • python3 tools/parity.py use_item_on with the new openable_case: PASS use_item_on,
    1 passed, 0 failed in 10.0 min. (probes built in 436s, then the harness's own 598s that built the
    client in a fresh worktree); the harness's own line is 4000/4000 cases match (0 oracle errors); vanilla planted in 671, started eating in 358, exploded 328 times and found a respawn spot in 365.
    All 152 openable cases matched.
  • With the Door, TrapDoor and FenceGate arms removed from use_without_item, the same harness
    failed: FAIL use_item_on, 0 passed, 1 failed, 3887/4000 cases match, 113 differing, e.g.
    empty hand on jungle_door: 3 differing, oak_planks on spruce_fence_gate: 3,
    empty hand on cherry_door: 3, empty hand on birch_fence_gate: 2, empty hand on acacia_trapdoor: 2.
    Vanilla's empty hand on jungle_door ends with G 0,0,0 minecraft:block_open | S 0,0,0 minecraft:block.wooden_door.open | set 0,0,0 16143 | set 0,1,0 16135 (both halves turned over, state
    16143 lower and 16135 upper) while Horizon sends no game event, no sound, changes no block and leaves
    the door as it was, with a different final level random. With a block in the hand the removed arm also
    shows the fall-through: vanilla oak_planks on cherry_fence_gate opens the gate
    (G 0,0,0 minecraft:block_open | set 0,0,0 15464) and Horizon places the planks beside it
    (G 0,0,-1 minecraft:block_place | S 0,0,-1 minecraft:block.wood.place | set 0,0,-1 15 | stat minecraft:oak_planks minecraft:used 1, 15 left in the hand).

Not proven: nothing in a real client; the harness runs the game headlessly. The in-game check is the
case itself: right-click a wooden door and both halves swing open with their sound, right-click an iron
door and nothing happens while the block in your hand is placed against it, and open a fence gate from
its back and watch it turn to face you.


🔄 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/7449 **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/openable-blocks` --- ### 📝 Commits (5) - [`69808d0`](https://github.com/horizon-rust/horizon/commit/69808d0fc43b365eda44e999bb8d3ea83ee98707) use_item_on: a clicked dragon egg teleports - [`97712ec`](https://github.com/horizon-rust/horizon/commit/97712ecdd5ce53b5b197d31f7a8285e361fe6307) use_item_on: doors, trapdoors and fence gates opened by hand - [`66f5d2e`](https://github.com/horizon-rust/horizon/commit/66f5d2ed9bbb39a428f69d1e6c275e9453833a8f) Merge main into #7425 - [`ae52503`](https://github.com/horizon-rust/horizon/commit/ae52503e8c7fde2d4ae4ab4f5a7c43aad3b7f68c) Merge #7425 and main into #7449 - [`ef6cc9f`](https://github.com/horizon-rust/horizon/commit/ef6cc9fa38d8b313c229b26992b287a8da825472) use_item_on: the openable and dragon egg branches each keep their own tail ### 📊 Changes **1 file changed** (+99 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_use_item_on_parity.py` (+99 -2) </details> ### 📄 Description A hand opens a door, a trapdoor and a fence gate, and the three vanilla behaviours agree on the shape of it: `DoorBlock.useWithoutItem` returns PASS when the material's `BlockSetType.canOpenByHand()` is false, otherwise cycles `open`, `setBlock(pos, state, 10)`, plays the open or close sound and sends `block_open`/`block_close`; `TrapDoorBlock.useWithoutItem` does the same through `toggle`, which uses flags 2, reschedules the water when the trapdoor is waterlogged and plays the sound through `playSound`; `FenceGateBlock.useWithoutItem` closes a gate that is open, and opening one that faces the player turns its `facing` to `player.getDirection()` first and draws its sound pitch from `level.getRandom().nextFloat() * 0.1F + 0.9F`. A pass leaves the click to the item, so a block in the hand is placed against the iron door instead. Horizon has all three arms (`Behaviours::use_without_item` in `crates/horizon-world/src/level/interact.rs`), but no harness case clicked an openable block: the harnesses that mention doors, trapdoors, levers and buttons (`test_redstone_parity.py`, `test_breaking_model_parity.py`) only power them, and `test_use_item_on_parity.py` used `oak_trapdoor` as scenery around a respawn anchor. The case is `openable_case` in `tools/test_use_item_on_parity.py`: a door (both halves, random facing, hinge, open and powered), a trapdoor (random facing, half, open, powered, waterlogged) or a fence gate (random facing, open, powered, `in_wall`) of every material, clicked on its own or the opposite face or the top/bottom one, by a player turned to one of twelve yaws, holding nothing or a stick, block, ingot, door or gate, survival or creative, sneaking or not. 152 of the run's 4000 cases are openable blocks (58 doors, 43 trapdoors, 51 fence gates): 119 change the clicked block, 48 of those move the door's second half with it, 39 fence gates turn to face the player as they open, 4 iron ones pass so the held block is placed instead, and the sneaking clicks with something in the hand place that block. **Proven:** - `python3 tools/parity.py use_item_on` with the new `openable_case`: `PASS use_item_on`, `1 passed, 0 failed in 10.0 min.` (probes built in 436s, then the harness's own 598s that built the client in a fresh worktree); the harness's own line is `4000/4000 cases match (0 oracle errors); vanilla planted in 671, started eating in 358, exploded 328 times and found a respawn spot in 365`. All 152 openable cases matched. - With the `Door`, `TrapDoor` and `FenceGate` arms removed from `use_without_item`, the same harness failed: `FAIL use_item_on`, `0 passed, 1 failed`, `3887/4000 cases match`, 113 differing, e.g. `empty hand on jungle_door: 3 differing`, `oak_planks on spruce_fence_gate: 3`, `empty hand on cherry_door: 3`, `empty hand on birch_fence_gate: 2`, `empty hand on acacia_trapdoor: 2`. Vanilla's `empty hand on jungle_door` ends with `G 0,0,0 minecraft:block_open | S 0,0,0 minecraft:block.wooden_door.open | set 0,0,0 16143 | set 0,1,0 16135` (both halves turned over, state 16143 lower and 16135 upper) while Horizon sends no game event, no sound, changes no block and leaves the door as it was, with a different final level random. With a block in the hand the removed arm also shows the fall-through: vanilla `oak_planks on cherry_fence_gate` opens the gate (`G 0,0,0 minecraft:block_open | set 0,0,0 15464`) and Horizon places the planks beside it (`G 0,0,-1 minecraft:block_place | S 0,0,-1 minecraft:block.wood.place | set 0,0,-1 15 | stat minecraft:oak_planks minecraft:used 1`, 15 left in the hand). **Not proven:** nothing in a real client; the harness runs the game headlessly. The in-game check is the case itself: right-click a wooden door and both halves swing open with their sound, right-click an iron door and nothing happens while the block in your hand is placed against it, and open a fence gate from its back and watch it turn to face you. --- <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:41 +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#7610
No description provided.