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:
Build the setup as shown in the provided attachment.
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
is duplicated by 65
relates to 2
Attachments
Comments 22
see MC-57916
It must be that the block detection is oversensitive about non-solid blocks like poppies and grass.
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
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.
Confirmed.