[PR #1085] [MERGED] Blocks can't be placed into mobs and other entities (Level.isUnobstructed) #3034

Closed
opened 2026-11-02 16:00:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/place-blocked-by-entities


📝 Commits (1)

  • 403fead Blocks can't be placed into mobs and other building blockers (Level.isUnobstructed)

📊 Changes

4 files changed (+126 additions, -22 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+87 -19)
📝 crates/horizon-client/src/game/tnt.rs (+1 -1)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java (+3 -1)
📝 tools/test_use_item_on_parity.py (+35 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #1052. Reported by Visivel on Discord: thanks! To answer mikenrafter's question: it wasn't obsidian-specific. Any block with a collision shape could be placed into any mob, and the mob was then stuck inside the block.

Stacked on #1081 (both extend tools/test_use_item_on_parity.py). Review the last commit; this PR retargets to main once #1081 merges.

What

BlockItem.canPlace → Level.isUnobstructed: placing a block now checks every entity whose blocksBuilding is set, as vanilla does (EntityGetter.isUnobstructed: not removed, its box overlaps the block's collision shape). Before, Horizon checked only players. That means:

  • mobs (every LivingEntity, babies at their smaller size) and armor stands (markers don't block)
  • boats, minecarts, end crystals, primed TNT and falling blocks

Blocks without a collision shape (flowers, torches, and so on) still go in, and dispensers placing blocks use the same check.

How

  • game.rs: GameLevel keeps borrowed slices of the blocking entities (Blockers); building_blocker_boxes collects their boxes for BuildingObstruction, which replaces PlayerObstruction. The check no longer needs a player.
  • Harness oracle: VanillaBlockUpdateOracle.World stubbed isUnobstructed(state, pos, context) to true. Now, when a harness supplies entities, it runs vanilla's own check (super). Without entities it still returns true.
  • tools/test_use_item_on_parity.py: new obstruction cases (1–2 mobs, armor stands or markers near or inside the target, babies, stone, glass, obsidian, slabs, fences, trapdoors and carpets).

Proof

Run on one integration commit holding all five B3 branches, rebased on origin/main 85f65a69, on the Mac mini:

cargo fmt --all --check                                         ok
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings   exit 0, 0 errors
cargo test -p horizon-client                                    1052 passed, 0 failed
  • tools/test_use_item_on_parity.py on this branch: 4000/4000 match (vanilla now refuses 104 of the obstruction cases). With the old stubbed oracle, exactly those 104 cases differed.
  • tools/test_dispenser_parity.py on this branch (it shares the oracle): 6000/6000 match.

tools/parity.py --changed origin/main: this branch changes game.rs, so it selects all 325 harnesses. Today's Mac mini (load ~70 from other agents' parity runs) couldn't finish the main baseline within the 2 h job limit; it was still building probes. CI's parity job runs the same --changed selection for this PR on the runner. Known failure on main: mob_ai drowned_* (#290).

Needs Ludovic

Nothing.

🤖 Generated with Claude Code


🔄 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/1085 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/place-blocked-by-entities` --- ### 📝 Commits (1) - [`403fead`](https://github.com/horizon-rust/horizon/commit/403fead15da1a32b727a7b50c8ebc9bd8a56d482) Blocks can't be placed into mobs and other building blockers (Level.isUnobstructed) ### 📊 Changes **4 files changed** (+126 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+87 -19) 📝 `crates/horizon-client/src/game/tnt.rs` (+1 -1) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java` (+3 -1) 📝 `tools/test_use_item_on_parity.py` (+35 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1052. Reported by **Visivel** on Discord: thanks! To answer **mikenrafter**'s question: it wasn't obsidian-specific. Any block with a collision shape could be placed into any mob, and the mob was then stuck inside the block. **Stacked on #1081** (both extend `tools/test_use_item_on_parity.py`). Review the last commit; this PR retargets to main once #1081 merges. ## What `BlockItem.canPlace` → `Level.isUnobstructed`: placing a block now checks every entity whose `blocksBuilding` is set, as vanilla does (`EntityGetter.isUnobstructed`: not removed, its box overlaps the block's collision shape). Before, Horizon checked only players. That means: - mobs (every `LivingEntity`, babies at their smaller size) and armor stands (markers don't block) - boats, minecarts, end crystals, primed TNT and falling blocks Blocks without a collision shape (flowers, torches, and so on) still go in, and dispensers placing blocks use the same check. ## How - `game.rs`: `GameLevel` keeps borrowed slices of the blocking entities (`Blockers`); `building_blocker_boxes` collects their boxes for `BuildingObstruction`, which replaces `PlayerObstruction`. The check no longer needs a player. - Harness oracle: `VanillaBlockUpdateOracle.World` stubbed `isUnobstructed(state, pos, context)` to true. Now, when a harness supplies entities, it runs vanilla's own check (`super`). Without entities it still returns true. - `tools/test_use_item_on_parity.py`: new obstruction cases (1–2 mobs, armor stands or markers near or inside the target, babies, stone, glass, obsidian, slabs, fences, trapdoors and carpets). ## Proof Run on one integration commit holding all five B3 branches, rebased on origin/main `85f65a69`, on the Mac mini: ``` cargo fmt --all --check ok set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings exit 0, 0 errors cargo test -p horizon-client 1052 passed, 0 failed ``` - `tools/test_use_item_on_parity.py` on this branch: **4000/4000** match (vanilla now refuses 104 of the obstruction cases). With the old stubbed oracle, exactly those 104 cases differed. - `tools/test_dispenser_parity.py` on this branch (it shares the oracle): **6000/6000** match. `tools/parity.py --changed origin/main`: this branch changes `game.rs`, so it selects all 325 harnesses. Today's Mac mini (load ~70 from other agents' parity runs) couldn't finish the main baseline within the 2 h job limit; it was still building probes. CI's parity job runs the same `--changed` selection for this PR on the runner. Known failure on main: mob_ai drowned_* (#290). ## Needs Ludovic Nothing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 16:00:57 +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#3034
No description provided.