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.
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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<L: LevelAccess + ?Sized> 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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user