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

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Works As Intended
    • Affects Version/s: Minecraft 17w45a, Minecraft 17w48a, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w02a, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w11a, Minecraft 18w19a, Minecraft 18w20c
    • Fix Version/s: None
    • Labels:
    • Confirmation Status:
      Confirmed

      Description

      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;
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rherlitz Rikard Herlitz
                Reporter:
                marcono1234 [Mod] Marcono1234
              • Votes:
                19 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: