[PR #7805] use_item_on: a clicked redstone wire toggles between dot and cross #7835

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

📋 Pull Request Information

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

Base: main ← Head: test/wire-toggle


📝 Commits (2)

  • bf4ae5c use_item_on: add the redstone wire dot and cross case
  • c390be3 use_item_on: generate the redstone wire dot and cross case

📊 Changes

1 file changed (+31 additions, -0 deletions)

View changed files

📝 tools/test_use_item_on_parity.py (+31 -0)

📄 Description

RedstoneWireBlock.useWithoutItem turns a wire between its two plain shapes: a wire that is neither a cross (connected to all four sides) nor a dot (connected to none) answers PASS, a player whose mayBuild is false answers PASS, and otherwise the wire takes the other shape keeping its POWER, getConnectionState recomputes which neighbours it still connects to, setBlockAndUpdate writes it and updatesOnShapeChange notifies the neighbours whose connection changed. Nothing is played and no game event is sent.

Nothing in the suite clicked a wire: test_redstone_parity.py places wire among other components and powers it through Level.setBlock. Horizon answers the click on main (Sim::wire_use in crates/horizon-world/src/level/interact.rs, reached from the Class::RedstoneWire arm); this adds the case that pins it.

The case clicks a wire with an empty hand in every combination of north/east/south/west (none, side or up) and POWER 0, 1, 7 or 15, with redstone components, wire or stone on some of its sides, from a random click face, in survival or creative.

Proven:

  • python3 tools/test_use_item_on_parity.py, 4000 cases, with the new case: 4000/4000 cases match (0 oracle errors); vanilla planted in 663, started eating in 355, exploded 305 times and found a respawn spot in 347. 286 of those cases are wire clicks.
  • With Class::RedstoneWire => self.wire_use(...) replaced by Consume, the same 4000 cases fail: 3940/4000 cases match, empty hand on redstone_wire: 60 differing — the 60 of the 286 whose wire is a dot or a cross, which is where vanilla changes anything; the rest pass the click on both sides. One of the 60, verbatim: case 0,0,0=minecraft:redstone_wire[east=up,north=up,power=1,south=side,west=up] ... -1,0,0=minecraft:redstone_wire[east=up,north=side,power=9,south=none,west=side] — native set 0,0,0 6147 | set -1,0,0 0 | N minecraft:item ... {count:1,id:"minecraft:redstone"} | held - offhand - using - | respawn - | rng -4306539528833948510, Horizon with neither state change, no dropped dust, and a different level random at the end.

Not proven: nothing in a real client; the run is headless. The mayBuild guard is not covered, because the fixture has no adventure mode. The 226 wire cases that are neither a dot nor a cross are pinned only as "both sides do nothing", which a missing arm would also satisfy; the 60 above are the ones that bite. The neighbour notification updatesOnShapeChange sends is seen only through what the neighbours then do — the second wire and the dropped dust in the example are exactly that, but nothing asserts the notification itself.


🔄 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/7805 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test/wire-toggle` --- ### 📝 Commits (2) - [`bf4ae5c`](https://github.com/horizon-rust/horizon/commit/bf4ae5c8907ffd47f17934f44cbd8142be05f703) use_item_on: add the redstone wire dot and cross case - [`c390be3`](https://github.com/horizon-rust/horizon/commit/c390be3360f6f1670a23b6f697d2413a7d7161f9) use_item_on: generate the redstone wire dot and cross case ### 📊 Changes **1 file changed** (+31 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_use_item_on_parity.py` (+31 -0) </details> ### 📄 Description `RedstoneWireBlock.useWithoutItem` turns a wire between its two plain shapes: a wire that is neither a `cross` (connected to all four sides) nor a `dot` (connected to none) answers `PASS`, a player whose `mayBuild` is false answers `PASS`, and otherwise the wire takes the other shape keeping its `POWER`, `getConnectionState` recomputes which neighbours it still connects to, `setBlockAndUpdate` writes it and `updatesOnShapeChange` notifies the neighbours whose connection changed. Nothing is played and no game event is sent. Nothing in the suite clicked a wire: `test_redstone_parity.py` places wire among other components and powers it through `Level.setBlock`. Horizon answers the click on `main` (`Sim::wire_use` in `crates/horizon-world/src/level/interact.rs`, reached from the `Class::RedstoneWire` arm); this adds the case that pins it. The case clicks a wire with an empty hand in every combination of `north`/`east`/`south`/`west` (`none`, `side` or `up`) and `POWER` 0, 1, 7 or 15, with redstone components, wire or stone on some of its sides, from a random click face, in survival or creative. **Proven:** - `python3 tools/test_use_item_on_parity.py`, 4000 cases, with the new case: `4000/4000 cases match (0 oracle errors); vanilla planted in 663, started eating in 355, exploded 305 times and found a respawn spot in 347`. 286 of those cases are wire clicks. - With `Class::RedstoneWire => self.wire_use(...)` replaced by `Consume`, the same 4000 cases fail: `3940/4000 cases match`, `empty hand on redstone_wire: 60 differing` — the 60 of the 286 whose wire is a dot or a cross, which is where vanilla changes anything; the rest pass the click on both sides. One of the 60, verbatim: `case 0,0,0=minecraft:redstone_wire[east=up,north=up,power=1,south=side,west=up] ... -1,0,0=minecraft:redstone_wire[east=up,north=side,power=9,south=none,west=side]` — native `set 0,0,0 6147 | set -1,0,0 0 | N minecraft:item ... {count:1,id:"minecraft:redstone"} | held - offhand - using - | respawn - | rng -4306539528833948510`, Horizon with neither state change, no dropped dust, and a different level random at the end. **Not proven:** nothing in a real client; the run is headless. The `mayBuild` guard is not covered, because the fixture has no adventure mode. The 226 wire cases that are neither a dot nor a cross are pinned only as "both sides do nothing", which a missing arm would also satisfy; the 60 above are the ones that bite. The neighbour notification `updatesOnShapeChange` sends is seen only through what the neighbours then do — the second wire and the dropped dust in the example are exactly that, but nothing asserts the notification itself. --- <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#7835
No description provided.