+ return cc->palette;
+ }
+
+ virtual video::SColor getItemstackColor(const ItemStack &stack,
+ Client *client) const
+ {
+ // Look for direct color definition
+ const std::string &colorstring = stack.metadata.getString("color", 0);
+ video::SColor directcolor;
+ if (!colorstring.empty() && parseColorString(colorstring, directcolor, true))
+ return directcolor;
+ // See if there is a palette
+ Palette *palette = getPalette(stack.name, client);
+ const std::string &index = stack.metadata.getString("palette_index", 0);
+ if (palette && !index.empty())
+ return (*palette)[mystoi(index, 0, 255)];
+ // Fallback color
+ return get(stack.name).color;