[PR #2156] [MERGED] Arrows press wooden buttons and keep them pressed #4057

Closed
opened 2026-11-03 04:14:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2156
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/buttons-pressed-by-arrows


📝 Commits (1)

  • a489d65 Arrows press wooden buttons and keep them pressed

📊 Changes

5 files changed (+148 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/arrows.rs (+23 -0)
📝 crates/horizon-client/src/game.rs (+41 -4)
📝 crates/horizon-world/src/level/hooks.rs (+7 -0)
📝 crates/horizon-world/src/level/mod.rs (+3 -0)
📝 crates/horizon-world/src/level/redstone.rs (+74 -8)

📄 Description

What and why

An arrow that stuck into a wooden button did not press it, and a button that was pressed some other way always released after its delay even with an arrow still in it. In vanilla a button whose type allows arrows (the wooden ones) is pressed by an arrow inside its shape and keeps re-scheduling its release while an arrow is still there.

This change:

  • adds ButtonBlock.checkPressed to the block behaviour library (button_check_pressed): the button should be pressed when its type allows arrows and an arrow is inside the button's shape, it presses or releases to match (neighbour updates, sound, game event), and it schedules its release again while pressed. button_tick now goes through it, so an arrow inside keeps the button pressed;
  • adds ButtonBlock.entityInside to entity_inside: an unpressed button that allows arrows is checked, so an arrow pressing it presses it at once;
  • asks "is an arrow inside this box?" through a new EntityQuery::Arrows, answered by the game from the arrows in flight or stuck and the thrown tridents (also AbstractArrow);
  • the button's shape box (6 by 4 pixels on the face it is attached to, 2 pixels thick, 1 when pressed) is built from its state, matching ButtonBlock.makeShapes;
  • the game now also runs the entityInside check, once per tick, for the blocks every arrow passed through (the same sweep an arrow already uses for fire and bubble columns), as it already does for players and minecarts. Stone buttons are not affected (their type does not allow arrows).

Not changed: pressure plates and tripwires still only count players and minecarts, as before.

Vanilla reference

  • ButtonBlock.entityInside (a button that allows arrows and is not pressed runs checkPressed) and ButtonBlock.tick
  • ButtonBlock.checkPressed (first AbstractArrow in getShape(...).bounds().move(pos), press or release, scheduleTick while pressed) and makeShapes
  • BlockSetType.canButtonBeActivatedByArrows (wooden types true, stone and polished blackstone false)

Self-check

cargo check -p horizon-client passes.


🔄 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/2156 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/buttons-pressed-by-arrows` --- ### 📝 Commits (1) - [`a489d65`](https://github.com/horizon-rust/horizon/commit/a489d65ab08bce13daa18a1970baedc1468fbae1) Arrows press wooden buttons and keep them pressed ### 📊 Changes **5 files changed** (+148 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/arrows.rs` (+23 -0) 📝 `crates/horizon-client/src/game.rs` (+41 -4) 📝 `crates/horizon-world/src/level/hooks.rs` (+7 -0) 📝 `crates/horizon-world/src/level/mod.rs` (+3 -0) 📝 `crates/horizon-world/src/level/redstone.rs` (+74 -8) </details> ### 📄 Description ## What and why An arrow that stuck into a wooden button did not press it, and a button that was pressed some other way always released after its delay even with an arrow still in it. In vanilla a button whose type allows arrows (the wooden ones) is pressed by an arrow inside its shape and keeps re-scheduling its release while an arrow is still there. This change: - adds `ButtonBlock.checkPressed` to the block behaviour library (`button_check_pressed`): the button should be pressed when its type allows arrows and an arrow is inside the button's shape, it presses or releases to match (neighbour updates, sound, game event), and it schedules its release again while pressed. `button_tick` now goes through it, so an arrow inside keeps the button pressed; - adds `ButtonBlock.entityInside` to `entity_inside`: an unpressed button that allows arrows is checked, so an arrow pressing it presses it at once; - asks "is an arrow inside this box?" through a new `EntityQuery::Arrows`, answered by the game from the arrows in flight or stuck and the thrown tridents (also `AbstractArrow`); - the button's shape box (6 by 4 pixels on the face it is attached to, 2 pixels thick, 1 when pressed) is built from its state, matching `ButtonBlock.makeShapes`; - the game now also runs the `entityInside` check, once per tick, for the blocks every arrow passed through (the same sweep an arrow already uses for fire and bubble columns), as it already does for players and minecarts. Stone buttons are not affected (their type does not allow arrows). Not changed: pressure plates and tripwires still only count players and minecarts, as before. ## Vanilla reference - `ButtonBlock.entityInside` (a button that allows arrows and is not pressed runs `checkPressed`) and `ButtonBlock.tick` - `ButtonBlock.checkPressed` (first `AbstractArrow` in `getShape(...).bounds().move(pos)`, press or release, `scheduleTick` while pressed) and `makeShapes` - `BlockSetType.canButtonBeActivatedByArrows` (wooden types true, stone and polished blackstone false) ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:22 +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#4057
No description provided.