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

One character namespaces are treated as "minecraft:"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 15w43c, Minecraft 15w45a, Minecraft 16w15b, Minecraft 1.10.2, Minecraft 16w42a, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11, Minecraft 16w50a, Minecraft 1.11.1, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13b, Minecraft 17w15a, Minecraft 17w16b, Minecraft 17w17b, Minecraft 17w18b, Minecraft 1.12 Pre-Release 2, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w45b, Minecraft 18w06a, Minecraft 18w15a
    • Fix Version/s: Minecraft 18w22a
    • Confirmation Status:
      Confirmed

      Description

      Apparently Minecraft treats one character long namespaces as "minecraft:"

      How to reproduce

      1. /give @p a:stone
        Works
      2. /give @p aa:stone
        Does not work
      1. /effect @p a:instant_health
        Works
      2. /effect @p aa:instant_health
        Does not work
      1. /advancement grant/revoke only a:root
        Works, affects minecraft:root
      2. /advancement grant/revoke only aa:root
        Doesn't work, unless you created a custom advancement with aa namespace
      1. Create a:test function
      2. /function @p a:test
        Doesn't work
      3. Create minecraft:test function and repeat step 2
        Works
      • (same can be done with advancements)

      Code analysis

      The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

      The reason why this happens is because the method net.minecraft.util.ResourceLocation.splitObjectName(String) only uses the provided namespace if the index of the colon (":") is higher than 1. Instead it should probably test if it is higher then 0 because only if it is 0 the String starts with the colon.

      protected static String[] splitObjectName(String toSplit)
      {
          String[] astring = new String[] {"minecraft", toSplit};
          int i = toSplit.indexOf(58);
      
          if (i >= 0)
          {
              astring[1] = toSplit.substring(i + 1, toSplit.length());
      
              // Replaced this
              //if (i > 1)
              if (i > 0)
              {
                  astring[0] = toSplit.substring(0, i);
              }
          }
      
          return astring;
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marcono1234 [Mod] Marcono1234
              • Votes:
                9 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: