Create a superflat world with carpets on top, like:
minecraft:bedrock,2*minecraft:dirt,minecraft:grass_block,minecraft:moss_carpet;minecraft:plainsuse:
/tick rate 9999And wait for a pillager patrol to spawn (this takes on average ~15 minutes at 200 tps)
Code analysis:
This is due to the fact that for regular mob spawning,
noCollisionis checked insideisValidSpawnPostitionForTypeinnet\minecraft\world\level\NaturalSpawner.java, but for pillager patrol spawning this is not checked insidePatrolSpawner.java.The blocks pillagers can spawn in are restricted by these conditions:
Block light level must be <=8 (
checkPatrollingMonsterSpawnRulesinnet\minecraft\world\entity\monster\PatrollingMonster.java)Conditions of
net\minecraft\world\level\NaturalSpawner.java:isValidEmptySpawnBlockThe 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_LEAVESheightmap, so the block the pillager spawns in must be ignored by this heightmap. It is defined innet\minecraft\world\level\levelgen\Heightmap.javaThis returns the first block which is either a fluid or a motion blocking block which is not a leaf.
blocksMotion()is defined asFor
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
This means pillagers can spawn inside snow layers up to 7 layers (tested), inside carpets, inside azaleas, etc.