mojira.dev
MC-306168

Pillager patrols can spawn inside blocks like carpets and lily pads

Create a superflat world with carpets on top, like:

minecraft:bedrock,2*minecraft:dirt,minecraft:grass_block,minecraft:moss_carpet;minecraft:plains

use:

/tick rate 9999

And wait for a pillager patrol to spawn (this takes on average ~15 minutes at 200 tps)

Attachments

Comments 4

Code analysis:

This is due to the fact that for regular mob spawning, noCollision is checked inside isValidSpawnPostitionForType in net\minecraft\world\level\NaturalSpawner.java, but for pillager patrol spawning this is not checked inside PatrolSpawner.java.

The blocks pillagers can spawn in are restricted by these conditions:

  • Block light level must be <=8 (checkPatrollingMonsterSpawnRules in net\minecraft\world\entity\monster\PatrollingMonster.java)

  • Conditions of net\minecraft\world\level\NaturalSpawner.java: isValidEmptySpawnBlock

    • The block must not be a full block

    • It must not be a redstone component

    • It must not be a fluid

    • It must not be inside #minecraft:prevent_mob_spawning_inside (which is currently just rails)

    • It must not be dangerous to the pillager (so not a wither rose for example)

  • It must be one above the top block of the MOTION_BLOCKING_NO_LEAVES heightmap, so the block the pillager spawns in must be ignored by this heightmap. It is defined in net\minecraft\world\level\levelgen\Heightmap.java

    • This returns the first block which is either a fluid or a motion blocking block which is not a leaf.

      • blocksMotion() is defined as

              @Deprecated
              public boolean blocksMotion() {
                 Block $$0 = this.getBlock();
                 return $$0 != Blocks.COBWEB && $$0 != Blocks.BAMBOO_SAPLING && this.isSolid();
              }
        • For isSolid(), blocks which volume < 35/48 and height < 1 are ignored, as well as ladders, snow layers, chorus flowers/plants, (flowering) azaleas, end rods and big dripleaf.

          • I’ve verified pillagers can spawn inside azalea using the command /execute as @e[type=minecraft:pillager] at @s run tellraw @a [{"selector":"@s"},{"text":" at "},{"nbt":"Pos","entity":"@s"}].

          • I’ve also verified pillagers can spawn inside lily pads

            image-20260202-222903.png

This means pillagers can spawn inside snow layers up to 7 layers (tested), inside carpets, inside azaleas, etc.

This also means pillagers can spawn with their head inside leaves

image-20260202-230313.png

Oops I meant average of the three dimensions, not the volume. So a slab has an average size of (1+1+0.5)/3 > 35/48, so pillagers don’t spawn inside slabs. For a block of 1 width and 1 height, this means only blocks with height <=3/16 are affected, so carpet, lily pads and snow layers.

Boas Bakker

(Unassigned)

Confirmed

Gameplay

Normal

Mob spawning

1.21.11

Retrieved