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

Squid behavior is based upon networked ID

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • 1.21 Pre-Release 1
    • None
    • Plausible
    • Mob behaviour

      Squids will initialize their random number generator based on their networked ID, which is incremented for each entity created on a given client or dedicated server run. As a result, squids will often have the same seeds and the same movement.

      To reproduce

      1. Start the client fresh without joining any other worlds
      2. Create a new void world, being careful not to spawn any entities
      3. Spawn a squid in a pool of water using /summon squid ~ ~ ~ {active_effects:[{duration:-1,show_icon:true,id:"glowing"\}],PersistenceRequired:1b}
      4. Observe the movement patterns of this squid
      5. Teleport the squid into the void to discard it from the world
      6. Restart the client, immediately rejoining the world
      7. Run the same command again
      8. Observe that the new squid moves in exactly the same manner

      Code analysis (Yarn mappings)

      The SquidEntity constructor contains the following line:

      this.random.setSeed((long) this.getId());
      

      I imagine this is a holdover from squids being moved by the client, but from what I can tell, the random doesn't need to be synchronized on the server and client anymore. Removing this line should give squids more unique seeds, fixing this issue.

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

              Created:
              Updated:
              Resolved:
              CHK: