docs: public static DrawItem getDrawItemFromItemStack(ItemStack is)
      {
          if (is == null)
              return null;
  
          DrawItem di = new DrawItem();
          String name = is.getUnlocalizedName();  // Get unlocalised name from the stack, not the stack's item - this ensures we keep the metadata.
          if (is.getHasSubtypes())
          {
              // If the item has subtypes, then there are varieties - eg different colours, types, etc.
              // Attempt to map from these subtypes back to variant/colour.
              // Do this by decomposing the unlocalised name:
              List<String> itemParts = new ArrayList<String>(Arrays.asList(name.split("\\.")));
              if (is.getItem() instanceof ItemMonsterPlacer)
              {
                  // Special case for eggs:
                  itemParts.add(ItemMonsterPlacer.getNamedIdFrom(is).toString());
              }
              // First part will be "tile" or "item".
              // Second part will be the item itself (eg "dyePowder" or "stainedGlass" etc).
              // Third part will be the variant, colour etc.
              Colour col = null;
              Variation var = null;
              for (int part = 2; part < itemParts.size(); part++)
              {
                  String section = itemParts.get(part);
                  // First see if this matches a colour:
                  if (col == null)
                  {
                      col = attemptToGetAsColour(section);
                      if (col == null && var == null) // If it wasn't a colour, check to see if it was a variant:
                          var = attemptToGetAsVariant(section, is);
                  }
                  else if (var == null)
                      var = attemptToGetAsVariant(section, is);
              }
              di.setColour(col);
              di.setVariant(var);
          }
          // Use the item registry name for the item - this is what we use in Types.XSD
          Object obj = Item.REGISTRY.getNameForObject(is.getItem());
          String publicName;
          if (obj instanceof ResourceLocation)
              publicName = ((ResourceLocation)obj).getResourcePath();
          else
              publicName = obj.toString();
          di.setType(publicName);
          return di;
      }