Mojira Archive
MC-74249

BlockPattern WitherBoss (and others) can be built incorrectly

The bug

The BlockPattern class is incorrectly matching blocks that aren't including the block being placed by the player.

Proof

In the screenshots provided, if you replace the red wool block with a wither skull the wither will be detected and spawned, even though the pattern matched was not comprised of the block the player placed.

Possible fix

Instead of using a block iterator iterating over all blocks in a cube (of size 3 for the wither as it is the max(width,height,depth) the BlockPattern class should be iterating over the inverted offsets of the BlockPattern. (e.g. translateOffset(position, face1, face2, -i, -j, -k))

(an optimization is to skip Predicates.alwaysTrue() and or unplaceable blocks).

There is a second bug that I am having troubles replicating, but involves modded minecraft where as the above is reproducible in vanilla. The second issue is involved with asymmetrical block patterns.