mojira.dev
MC-60792

Iron golems and withers can't be summoned via building them if there are blocks located near their bases or heads

The Bug:

Iron golems and withers can't be summoned via building them if there are blocks located near their bases or heads.

Steps to Reproduce:

  1. Build the setup as shown in the provided attachment.

[media]
  1. Place a carved pumpkin in the middle and on the top of the iron blocks in an attempt to summon an iron golem.

Observed Behavior:

Iron golems and withers aren't summoned.

Expected Behavior:

Iron golems and withers would be summoned.

Code Analysis:

Code analysis by @unknown can be found in this comment.

Linked issues

MC-57545 Wither Spawning Bug Resolved MC-63283 You cannot create an iron golem Resolved MC-63975 Error loading world Resolved MC-63980 Spawning a utility mob on its side using dispensers sometimes doesn't work Resolved MC-63991 Not able to spawn wither boss Resolved

Attachments

Comments 22

see MC-57916

It must be that the block detection is oversensitive about non-solid blocks like poppies and grass.

In 1.7.10 the golem did spawn, in 14w27c any block besides the base or the head prevents spawning

its counting non-opaque blocks to like tallgrass too.

That might be why I can't get my golems to fire up even though I have made them correctly, if the grass is now being counted as a block too

12 more comments

Can confirm in 1.18.2 and 22w18a.

Code analysis (Mojang mappings, 22w18a):
For iron golems, the following pattern is required:

~^~
###
~#~

where # is an iron block, ^ is a carved pumpkin and ~ is an air block. Therefore, it is required that all four blocks around the block pattern are air blocks:

net.minecraft.world.level.block.CarvedPumpkinBlock.java

...
    private BlockPattern getOrCreateIronGolemFull() {
        if (this.ironGolemFull == null) {
            this.ironGolemFull = BlockPatternBuilder.start().aisle("~^~", "###", "~#~").where('^', BlockInWorld.hasState(PUMPKINS_PREDICATE)).where('#', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.IRON_BLOCK))).where('~', BlockInWorld.hasState(BlockMaterialPredicate.forMaterial(Material.AIR))).build();
        }
        return this.ironGolemFull;
    }
...

The same issue happens with wither skeleton skulls:

net.minecraft.world.level.block.WitherSkullBlock.java

...
    private static BlockPattern getOrCreateWitherFull() {
        if (witherPatternFull == null) {
            witherPatternFull = BlockPatternBuilder.start().aisle("^^^", "###", "~#~").where('#', (BlockInWorld $$0) -> $$0.getState().is(BlockTags.WITHER_SUMMON_BASE_BLOCKS)).where('^', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.WITHER_SKELETON_SKULL).or(BlockStatePredicate.forBlock(Blocks.WITHER_SKELETON_WALL_SKULL)))).where('~', BlockInWorld.hasState(BlockMaterialPredicate.forMaterial(Material.AIR))).build();
        }
        return witherPatternFull;
    }
...

Instead of only checking AIR blocks, why not check all blocks that have no collision (like grass, snow layers, sprouts, vines, etc.)? There is a slight nuance to this though; fixing this bug would cause all the blocks in this 3x3x1 area to be deleted (turned into air blocks), so that would probably have to be fixed as well.

Can confirm in 1.19.2.

Can confirm in 23w03a

Russell Rains

Avoma

(Unassigned)

Confirmed

Gameplay

Normal

Mob spawning

iron_golem, wither

Minecraft 14w27b, 1.17.1, 21w39a, 1.18 Pre-release 5, 1.18.1, ..., 24w46a, 1.21.4, 25w08a, 1.21.5, 1.21.6

Retrieved