Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-161133

Chests on Windows and Xbox have different loot than other platforms

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.30.22 Preview, 1.19.20, 1.20.10
    • None
    • Confirmed
    • Windows
    • 883804

      The same chest on any given seed often has different loot on Windows/Xbox than on other platforms (eg iOS, Playstation etc).

      Steps to Reproduce:
      Create a new world on Windows or Xbox entering something in to the seed field
      Use /locate buriedtreasure to find a buried treasure chest
      Use /tp to teleport to the buried treasure
      Open buried treasure chest, note down loot
      Repeat (using the same seed) on any platform other than Windows/Xbox

      Observed Results:
      The loot in the chest on Windows/Xbox is different than other platforms

      Expected Results:
      The loot is the same regardless of which platform is used.

      Notes:
      The problem occurs during the unpacking of the loot table. Windows and Xbox use a different position in the RNG sequence when calling RandomValueBounds::getInt from LootPool::addRandomItems. For all platforms two RNG values are consumed on all platforms at this point in the unpacking of the loot table, Windows/Xbox uses the 2nd of these values while other platforms use the 1st. This results in a different number of "rolls" for the loot pool.

      What appears to be happening (digging in to the code) is that on Windows (and I assume xbox) FloatRange::getValue is called (for something to do with luck) and then RandomValueBounds::getInt is called to get the "rolls" value. I suspect on other platforms these calls are being made in the opposite order. This causes the rng to be in the same state on all platforms after these calls but to have different "rolls" values.

      To illustrate this occurring I've attached a text file comparing how the loot unpacks for a buried treasure chest (grid 0,0) on 1000 different seeds. You'll note that the loot is identical up to a point and then either windows/xbox or other platforms gets extra items due to getting a different "rolls" value than the other platforms. I've included the world seed, the chest seed, chest location and loot for easy replication.

      I'd suggest other platforms have these RNG calls re-aligned to the order the calls are made on Windows/Xbox as most seed showcase videos tend to recorded on Windows and this would mean the large mobile player base would get loot that matches what they see in these showcase videos.

      Happy to provide extra details or clarification if required.

            crackedMagnet Matthew Ferguson
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              CHK: