[PR #7804] use_item_on: a repeater, comparator and daylight detector clicked by hand #7834

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/7804
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: test/diode-controls


📝 Commits (2)

  • 38be47f use_item_on: add the repeater, comparator and daylight detector case
  • 39d1289 use_item_on: generate the repeater, comparator and daylight detector case

📊 Changes

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

View changed files

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

📄 Description

A repeater, a comparator and a daylight detector each turn one of their own properties on BlockBehaviour.useWithoutItem, and nothing in the suite clicked any of them: test_redstone_parity.py places all three and powers them through Level.setBlock, so the click path had no case.

  • RepeaterBlock.useWithoutItem: PASS when Player.getAbilities().mayBuild is false, otherwise the state cycles DELAY through 1 to 4 and setBlockAndUpdate writes it, with no sound and no game event.
  • ComparatorBlock.useWithoutItem: the same mayBuild guard, then MODE cycles between compare and subtract, block.comparator.click plays at volume 0.3 with pitch 0.55 for subtract and 0.5 for compare, Level.setBlock writes the state, and the comparator refreshes its output while it is still the block at that position.
  • DaylightDetectorBlock.useWithoutItem: the same mayBuild guard (it answers super.useWithoutItem, which is PASS), then INVERTED cycles, the state is written, GameEvent.BLOCK_CHANGE is sent and the POWER it emits is recomputed.

Horizon answers all three on main (crates/horizon-world/src/level/interact.rs: Class::Repeater, Class::Comparator and Class::DaylightDetector, over level/redstone.rs's comparator_refresh and daylight_detector_update_signal); this adds the case that pins them.

The case clicks a repeater (any facing, delay 1 to 4, locked either way), a comparator (any facing, either mode) or a daylight detector (either inverted, any power) with an empty hand, sometimes with a redstone component or stone in front of the diode for it to read.

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 684, started eating in 367, exploded 326 times and found a respawn spot in 364. 209 of those cases are the new clicks (93 comparators, 72 repeaters, 44 daylight detectors), and every one of them is a case the negative run below moves.
  • With Class::Repeater, Class::Comparator and Class::DaylightDetector in crates/horizon-world/src/level/interact.rs replaced by Consume, the same 4000 cases fail: 3791/4000 cases match, empty hand on comparator: 93 differing, empty hand on repeater: 72 differing, empty hand on daylight_detector: 44 differing. Two of them, verbatim:
    • case 0,0,0=minecraft:comparator[facing=north,mode=compare,powered=true] ... use={"item": "-", "creative": true, ...} — native S 0,0,0 minecraft:block.comparator.click | held - offhand - using - | respawn - | rng 6482913574058981850 | set 0,0,0 13032, Horizon only held - offhand - using - | respawn - | rng 6482913574058981850.
    • case 0,0,0=minecraft:daylight_detector[inverted=true,power=9] ... — native G 0,0,0 minecraft:block_change | ... | set 0,0,0 13077, Horizon without the game event and without the state change.

Not proven: nothing in a real client; the run is headless. The mayBuild guard is not covered at all: the fixture clicks as a survival or creative player and has no adventure mode, so PASS for a player who may not build stays unpinned for all three blocks. The comparator's refreshOutputState and the detector's signal recomputation are only seen through the state and events they leave behind, not through the power a neighbouring component would take from them.


🔄 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/7804 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test/diode-controls` --- ### 📝 Commits (2) - [`38be47f`](https://github.com/horizon-rust/horizon/commit/38be47f1cddb29fdcdbdbf8bf08820431580c8fb) use_item_on: add the repeater, comparator and daylight detector case - [`39d1289`](https://github.com/horizon-rust/horizon/commit/39d128927b56be98432cea8a90f57f397643cd3b) use_item_on: generate the repeater, comparator and daylight detector case ### 📊 Changes **1 file changed** (+35 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_use_item_on_parity.py` (+35 -0) </details> ### 📄 Description A repeater, a comparator and a daylight detector each turn one of their own properties on `BlockBehaviour.useWithoutItem`, and nothing in the suite clicked any of them: `test_redstone_parity.py` places all three and powers them through `Level.setBlock`, so the click path had no case. - `RepeaterBlock.useWithoutItem`: `PASS` when `Player.getAbilities().mayBuild` is false, otherwise the state cycles `DELAY` through 1 to 4 and `setBlockAndUpdate` writes it, with no sound and no game event. - `ComparatorBlock.useWithoutItem`: the same `mayBuild` guard, then `MODE` cycles between `compare` and `subtract`, `block.comparator.click` plays at volume 0.3 with pitch 0.55 for `subtract` and 0.5 for `compare`, `Level.setBlock` writes the state, and the comparator refreshes its output while it is still the block at that position. - `DaylightDetectorBlock.useWithoutItem`: the same `mayBuild` guard (it answers `super.useWithoutItem`, which is `PASS`), then `INVERTED` cycles, the state is written, `GameEvent.BLOCK_CHANGE` is sent and the `POWER` it emits is recomputed. Horizon answers all three on `main` (`crates/horizon-world/src/level/interact.rs`: `Class::Repeater`, `Class::Comparator` and `Class::DaylightDetector`, over `level/redstone.rs`'s `comparator_refresh` and `daylight_detector_update_signal`); this adds the case that pins them. The case clicks a repeater (any `facing`, `delay` 1 to 4, `locked` either way), a comparator (any `facing`, either `mode`) or a daylight detector (either `inverted`, any `power`) with an empty hand, sometimes with a redstone component or stone in front of the diode for it to read. **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 684, started eating in 367, exploded 326 times and found a respawn spot in 364`. 209 of those cases are the new clicks (93 comparators, 72 repeaters, 44 daylight detectors), and every one of them is a case the negative run below moves. - With `Class::Repeater`, `Class::Comparator` and `Class::DaylightDetector` in `crates/horizon-world/src/level/interact.rs` replaced by `Consume`, the same 4000 cases fail: `3791/4000 cases match`, `empty hand on comparator: 93 differing`, `empty hand on repeater: 72 differing`, `empty hand on daylight_detector: 44 differing`. Two of them, verbatim: - `case 0,0,0=minecraft:comparator[facing=north,mode=compare,powered=true] ... use={"item": "-", "creative": true, ...}` — native `S 0,0,0 minecraft:block.comparator.click | held - offhand - using - | respawn - | rng 6482913574058981850 | set 0,0,0 13032`, Horizon only `held - offhand - using - | respawn - | rng 6482913574058981850`. - `case 0,0,0=minecraft:daylight_detector[inverted=true,power=9] ...` — native `G 0,0,0 minecraft:block_change | ... | set 0,0,0 13077`, Horizon without the game event and without the state change. **Not proven:** nothing in a real client; the run is headless. The `mayBuild` guard is not covered at all: the fixture clicks as a survival or creative player and has no adventure mode, so `PASS` for a player who may not build stays unpinned for all three blocks. The comparator's `refreshOutputState` and the detector's signal recomputation are only seen through the state and events they leave behind, not through the power a neighbouring component would take from them. --- <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#7834
No description provided.