From 3fe8aa76b2d0f9c16ffa82a670a53dd6250885f3 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:30:05 +0100 Subject: [PATCH] Build a golem whenever a carved pumpkin is placed CarvedPumpkinBlock.onPlace runs on every placement; /setblock, /fill, /clone and piston moves never completed a golem. --- crates/horizon-client/src/game.rs | 5 +++++ crates/horizon-world/src/level/hooks.rs | 9 ++++++++- crates/horizon-world/src/level/mod.rs | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 2d9dc2797..3c0bed9bf 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -3522,6 +3522,11 @@ impl Game<'_> { state, kind: "dispense", } => self.dispense_from(pos, state)?, + LevelEvent::BlockEvent { + pos, + kind: "golem", + .. + } => self.check_golem_spawn([pos.x, pos.y, pos.z])?, LevelEvent::BlockEvent { pos, kind: "command_block", diff --git a/crates/horizon-world/src/level/hooks.rs b/crates/horizon-world/src/level/hooks.rs index eb9fd4906..c5898b19c 100644 --- a/crates/horizon-world/src/level/hooks.rs +++ b/crates/horizon-world/src/level/hooks.rs @@ -1,7 +1,7 @@ //! `neighborChanged`, `onPlace`, `affectNeighborsAfterRemoval` and //! `updateIndirectNeighbourShapes` for the overriding vanilla classes. use super::{ - LevelAccess, Sim, + LevelAccess, LevelEvent, Sim, classes::Class, states::BlockId, update::{below, rel}, @@ -189,6 +189,13 @@ impl Sim<'_, L> { self.schedule_tick(pos, block, 1); } Class::Shelf => self.shelf_on_place(pos, state, old), + // CarvedPumpkinBlock.onPlace: a pumpkin placed by any means may + // complete a golem; the caller builds it. + Class::CarvedPumpkin if !same => self.emit(LevelEvent::BlockEvent { + pos, + state, + kind: "golem", + }), Class::SnifferEgg => { let boosted = b.is_block(self.below_state(pos), b.named.moss_block); if boosted { diff --git a/crates/horizon-world/src/level/mod.rs b/crates/horizon-world/src/level/mod.rs index d6c579c30..f0af584ff 100644 --- a/crates/horizon-world/src/level/mod.rs +++ b/crates/horizon-world/src/level/mod.rs @@ -262,7 +262,9 @@ pub enum LevelEvent { /// block's scheduled tick: `checkReset`), `"hatch"` (frogspawn /// hatched into tadpoles; the block is already destroyed), `"portal_spawn"` /// (a nether portal won its zombified piglin roll; the caller checks - /// `anyPlayerCloseEnoughForSpawning` and spawns below the portal). + /// `anyPlayerCloseEnoughForSpawning` and spawns below the portal), + /// `"golem"` (a carved pumpkin was placed; the caller builds the golem + /// its blocks complete). BlockEvent { pos: BlockPos, state: BlockStateId,