[PR #3959] [MERGED] Golems: a snow or iron golem builds in any orientation, as vanilla does #5321

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3959
Author: @DenisHumen
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/golem-pattern-orientations


📝 Commits (1)

  • d1a62e6 Golems: build a snow or iron golem in any orientation, as vanilla does

📊 Changes

1 file changed (+151 additions, -29 deletions)

View changed files

📝 crates/horizon-client/src/game/golems.rs (+151 -29)

📄 Description

🤖 Opened by DenisHumen's AI agent (Claude Code, Opus 5.5), not by DenisHumen personally.

What

A carved pumpkin (or jack o'lantern) now builds a snow golem when the two snow blocks lie beside it, on its side or upside down, not only straight below it. The iron golem's T works the same way when it lies on its back. Vanilla builds both in every orientation.

Fixes #3929

Why

CarvedPumpkinBlock.trySpawnGolem calls BlockPattern.find(level, pos), which goes through:

  • every block of the box from pos to pos + max(width, height, depth) - 1 as the pattern's corner, x fastest, then y, then z (BlockPos.betweenClosed);
  • every forwards and every up in Direction.values() order, skipping the pairs where they lie along each other;

and returns the first match where every cell passes the pattern's predicates. translateAndRotate puts cell (x right, y down) at origin - up*y + (forwards × up)*x. Read from the 26.3 jar with javap.

Horizon only matched the upright column, and the upright T with arms along X or Z, so a lying snow column, like the one in the report, did nothing.

Fix

find_pattern in game/golems.rs follows find and translateAndRotate for the one-aisle patterns, with their predicates: ^ a carved pumpkin or jack o'lantern, # snow or iron block, ~ air.

  • find_golem tries the snow pattern first, then the iron one, as trySpawnGolem does.
  • The cleared blocks keep the clearPatternBlocks order.
  • The spawn base is getBlock(0, 2, 0) for snow and getBlock(1, 2, 0) for iron.

The copper golem and the wither aren't changed.

Checked

  • In game, fast build, with a scratch home and horizon-ctl: two snow blocks at 1 100 0 and 2 100 0, then place 0 100 0 --item carved_pumpkin.
    • Before (build of main): the pumpkin stays and no golem appears.
    • After: all three blocks clear and a snow golem appears at 2.5 100 0.5, the bottom of the lying column.
  • Unit tests in golems.rs:
    • the snow column counts in all six directions from the head;
    • a bent or short column doesn't count;
    • a lying iron T counts, and a block beside its legs stops it.
  • pr_ready:
    • The one failing test, entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed, also fails on main (#3840, fixed by #3851).
    • The clippy failure comes from lints new in clippy 1.96, in code this PR doesn't touch. With those three lints allowed, cargo clippy -p horizon-client --all-targets -- -D warnings is clean.
    • Parity can't start on Windows (tools/parity.py imports fcntl).

pr_ready (tools/pr_ready.py --base upstream/main on DenisPC, against upstream/main at c77007444, 3 min 3 s)

Check Result
Scope ✅ 1 files, +151 −29
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 474 passed (58 s)
rustfmt ✅ (7 s)
clippy ❌ failed (22 s)
tests: horizon-client ❌ 672 passed, 1 failed (1 min 27 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 361 affected, (1 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/3959 **Author:** [@DenisHumen](https://github.com/DenisHumen) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/golem-pattern-orientations` --- ### 📝 Commits (1) - [`d1a62e6`](https://github.com/horizon-rust/horizon/commit/d1a62e68ec9da9c23001bdc6273afe658f1fbcea) Golems: build a snow or iron golem in any orientation, as vanilla does ### 📊 Changes **1 file changed** (+151 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/golems.rs` (+151 -29) </details> ### 📄 Description > 🤖 Opened by DenisHumen's AI agent (Claude Code, Opus 5.5), not by DenisHumen personally. ## What A carved pumpkin (or jack o'lantern) now builds a snow golem when the two snow blocks lie beside it, on its side or upside down, not only straight below it. The iron golem's T works the same way when it lies on its back. Vanilla builds both in every orientation. Fixes #3929 ## Why `CarvedPumpkinBlock.trySpawnGolem` calls `BlockPattern.find(level, pos)`, which goes through: - every block of the box from `pos` to `pos + max(width, height, depth) - 1` as the pattern's corner, `x` fastest, then `y`, then `z` (`BlockPos.betweenClosed`); - every `forwards` and every `up` in `Direction.values()` order, skipping the pairs where they lie along each other; and returns the first match where every cell passes the pattern's predicates. `translateAndRotate` puts cell (x right, y down) at `origin - up*y + (forwards × up)*x`. Read from the 26.3 jar with `javap`. Horizon only matched the upright column, and the upright T with arms along X or Z, so a lying snow column, like the one in the report, did nothing. ## Fix `find_pattern` in `game/golems.rs` follows `find` and `translateAndRotate` for the one-aisle patterns, with their predicates: `^` a carved pumpkin or jack o'lantern, `#` snow or iron block, `~` air. - `find_golem` tries the snow pattern first, then the iron one, as `trySpawnGolem` does. - The cleared blocks keep the `clearPatternBlocks` order. - The spawn base is `getBlock(0, 2, 0)` for snow and `getBlock(1, 2, 0)` for iron. The copper golem and the wither aren't changed. ## Checked - In game, fast build, with a scratch home and `horizon-ctl`: two snow blocks at `1 100 0` and `2 100 0`, then `place 0 100 0 --item carved_pumpkin`. - Before (build of `main`): the pumpkin stays and no golem appears. - After: all three blocks clear and a snow golem appears at `2.5 100 0.5`, the bottom of the lying column. - Unit tests in `golems.rs`: - the snow column counts in all six directions from the head; - a bent or short column doesn't count; - a lying iron T counts, and a block beside its legs stops it. - pr_ready: - The one failing test, `entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed`, also fails on `main` (#3840, fixed by #3851). - The clippy failure comes from lints new in clippy 1.96, in code this PR doesn't touch. With those three lints allowed, `cargo clippy -p horizon-client --all-targets -- -D warnings` is clean. - Parity can't start on Windows (`tools/parity.py` imports `fcntl`). **pr_ready** (`tools/pr_ready.py --base upstream/main` on DenisPC, against upstream/main at c77007444, 3 min 3 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +151 −29 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 474 passed (58 s) | | rustfmt | ✅ (7 s) | | clippy | ❌ failed (22 s) | | tests: horizon-client | ❌ 672 passed, 1 failed (1 min 27 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 361 affected, (1 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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-03 05:11:47 +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#5321
No description provided.