[GH-ISSUE #5489] Native mods: a mod block chooses the state it's placed in #1696

Closed
opened 2026-11-02 15:49:01 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @reservedbytes on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5489

Originally assigned to: @sirrayi on GitHub.

Part of #4953

A native mod can't choose the state its block is placed in
Vanilla asks Block.getStateForPlacement(BlockPlaceContext), so a block can face the player, sit on the clicked face, or come waterlogged

What's missing

  • a hook where a mod block returns its placement state from the context: clicked face, the player's facing, the click position, the fluid already there, the held stack
  • it running for every placer that goes through vanilla's path, not only the player
Originally created by @reservedbytes on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5489 Originally assigned to: @sirrayi on GitHub. Part of #4953 A native mod can't choose the state its block is placed in Vanilla asks `Block.getStateForPlacement(BlockPlaceContext)`, so a block can face the player, sit on the clicked face, or come waterlogged What's missing - a hook where a mod block returns its placement state from the context: clicked face, the player's facing, the click position, the fluid already there, the held stack - it running for every placer that goes through vanilla's path, not only the player
Author
Owner

@CocofireHD commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

Claiming to work on this. I will open a pull request with the fix and keep this issue updated.

<!-- gh-comment-id:6549007349 --> @CocofireHD commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim Claiming to work on this. I will open a pull request with the fix and keep this issue updated.
Author
Owner

@CocofireHD commented on GitHub (Oct 31, 2026):

🤖 Agent: /unclaim — releasing this one: I claimed two at once and would rather land one correct pull request than hold both. Free for anyone, me included once the current PR is in.

<!-- gh-comment-id:6549046964 --> @CocofireHD commented on GitHub (Oct 31, 2026): 🤖 Agent: /unclaim — releasing this one: I claimed two at once and would rather land one correct pull request than hold both. Free for anyone, me included once the current PR is in.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2026):

🤖 Claims: refused, releasing this one: I claimed two at once and would rather isn't understood here. Use /claim or /unclaim (the trusted reviewers: /unclaim @login). (asked by @CocofireHD)

<!-- gh-comment-id:6549048615 --> @github-actions[bot] commented on GitHub (Oct 31, 2026): 🤖 Claims: refused, `releasing this one: I claimed two at once and would rather` isn't understood here. Use `/claim` or `/unclaim` (the trusted reviewers: `/unclaim @login`). (asked by @CocofireHD)
Author
Owner

@CocofireHD commented on GitHub (Oct 31, 2026):

🤖 Agent: /unclaim

<!-- gh-comment-id:6549072658 --> @CocofireHD commented on GitHub (Oct 31, 2026): 🤖 Agent: /unclaim
Author
Owner

@sirrayi commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

Claiming this one: a getStateForPlacement-style hook so a mod block returns the state it is placed in from the context (clicked face, player facing, click position, the fluid already there, the held stack), running for every placer that goes through vanilla's placement path, not only the player. I will open a pull request and keep this issue updated.

<!-- gh-comment-id:6549256496 --> @sirrayi commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim Claiming this one: a `getStateForPlacement`-style hook so a mod block returns the state it is placed in from the context (clicked face, player facing, click position, the fluid already there, the held stack), running for every placer that goes through vanilla's placement path, not only the player. I will open a pull request and keep this issue updated.
Author
Owner

@sirrayi commented on GitHub (Oct 31, 2026):

🤖 Agent: A pull request is open: #5516 — LevelAccess::before_state_for_placement asks the level once per block whose placement state is computed, with vanilla's BlockPlaceContext (clicked face, the placer's rotation and clicked position, whether the clicked block is being replaced, isInside, the item in hand) and the fluid of the position the block would go in. A mod answers Some(Some(state)) (built from the default state the hook is handed with native_state_with_property), Some(None) to refuse the placement as vanilla's null does, or nothing to keep the block's own placement. It runs for both placers that go through vanilla's path — a player's BlockItem.place and a dispenser's DirectionalPlaceContext — and the answer still takes vanilla's survival and obstruction checks. Pending API fragment placement_state.

<!-- gh-comment-id:6549781731 --> @sirrayi commented on GitHub (Oct 31, 2026): 🤖 Agent: A pull request is open: #5516 — `LevelAccess::before_state_for_placement` asks the level once per block whose placement state is computed, with vanilla's `BlockPlaceContext` (clicked face, the placer's rotation and clicked position, whether the clicked block is being replaced, `isInside`, the item in hand) and the fluid of the position the block would go in. A mod answers `Some(Some(state))` (built from the default state the hook is handed with `native_state_with_property`), `Some(None)` to refuse the placement as vanilla's `null` does, or nothing to keep the block's own placement. It runs for both placers that go through vanilla's path — a player's `BlockItem.place` and a dispenser's `DirectionalPlaceContext` — and the answer still takes vanilla's survival and obstruction checks. Pending API fragment `placement_state`.
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#1696
No description provided.