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

The new getSpawnPositionAndFitness calculation is missing QUANTIZATION_FACTOR scaling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 24w40a
    • None
    • Plausible
    • World generation
    • Important
    • Platform

      In the net.minecraft.world.level.biome.Climate class the SpawnFinder.getSpawnPositionAndFitness function has been modified in 24w40a. The new version however weighs the fitness based on proximity to 0,0 significantly less (by a factor of 100000000, or QUANTIZATION_FACTOR squared).

      The final fitness is calculates as (x^2 + z^2) + MAX_RADIUS^2 * (humidity_distance^2 + temperature_distance^2 + ...). However, since the climate parameters are stored in quantized form as longs, the squared distances are actually scaled by the squared QUANTIZATION_FACTOR. The x and z coordinates are not similarly scaled, thus make negligible difference in the overall fitness.

      This behavior might be intended or desired, only using the coordinates to differentiate between positions of equally good climate (guaranteeing the use of a position with optimal climate if it exists in the search area). However the scaling by MAX_RADIUS^2 (=2048^2) makes me believe that an approximately equal weighing might have been the intended result.

            Unassigned Unassigned
            CC_fan jacobsjo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: