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

@r (random) selector does not work for non-players anymore

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • Minecraft 17w45a, Minecraft 17w48a, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w02a, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w11a, Minecraft 18w19a, Minecraft 18w20c
    • Confirmed

      The bug

      The type argument can no longer be used for the @r selector to select non-player entities.

      How to reproduce

      1. Make sure there are other entities in the world
      2. Use the following command
        /say @r[type=!player]
        

      Code analysis

      From this comment

      The following is based on a decompiled version of Minecraft snapshot 17w45b (obfuscated) decompiled using CFR v122

      This is because the class cx.java, which appears to parse selectors, sets the properties l, presumably named selectsNonPlayer or equivalent when deobfuscated to false. The relevant code is as follows:

      else if (c2 == 'r') {
          this.k = 1;
          this.l = false; //Should be true
          this.y = i;
      }
      

            rherlitz Rikard Herlitz
            marcono1234 Marcono1234
            Votes:
            19 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: