Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-276625

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 24w37a, 24w40a
    • None
    • Community Consensus
    • Crash, Data Packs
    • Normal
    • Platform

      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.

        1. MC-276625 After Freeze.png
          2.33 MB
          haykam

            Unassigned Unassigned
            haykam haykam
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: