mojira.dev
MC-276625

Strider spawning freezes the server when the empty fluid is in the lava tag

A data pack that adds the minecraft:empty fluid to the #minecraft:lava fluid tag will cause the game to freeze when attempting to spawn a strider.

Steps to reproduce

1. Load a data pack with a #minecraft:lava fluid tag containing the minecraft:empty fluid. An example data pack is attached.
2. Visit the Nether: /execute in minecraft:the_nether run tp @s ~ 100 ~
3. Move around until in a location where striders would normally spawn.
4. Observe that the server is now frozen.

Code analysis (Yarn mappings)

A loop is controlled by a tag in the StriderEntity.canSpawn method, which allows out-of-world positions to satisfy the condition and infinitely move the position up:

public static boolean canSpawn(EntityType<StriderEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
	BlockPos.Mutable mutablePos = pos.mutableCopy();

	do {
		mutablePos.move(Direction.UP);
	} while (world.getFluidState(mutablePos).isIn(FluidTags.LAVA));

	return world.getBlockState(mutablePos).isAir();
}

A suggested fix would be to add an additional condition for the world top Y position to this loop.

Attachments

Comments 3

I wasn't able to reproduce this in our latest snapshots, could you give it another go?

I was able to reproduce again in Minecraft snapshot 24w40a. I've attached the data pack I used to test as well as what the game looks like after the freeze occurs - I hope this helps in reproducing the issue.

Can confirm in 24w40a

haykam

(Unassigned)

Community Consensus

Platform

Normal

Crash, Data Packs

24w37a, 24w40a

Retrieved