@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
26 lines (25 loc) • 1.02 kB
TypeScript
/**
* Utility class for block type operations.
*/
export default class BlockTypeUtilities {
private static keywordColorHints;
/**
* Convert HSL color values to hex color string.
* @param h Hue (0-360)
* @param s Saturation (0-100)
* @param l Lightness (0-100)
*/
private static hslToHex;
/**
* Generate a fallback color for custom blocks without a defined map_color.
* Uses two strategies:
* 1. Keyword hints: If the block ID contains certain Minecraft-related keywords,
* use a color associated with that material/concept.
* 2. Hash-based: If no keywords match, generate a consistent color from the block ID hash.
* This ensures the same block always gets the same color, but different blocks get distinct colors.
*
* @param blockTypeId The full block type identifier (e.g., "mymod:custom_stone_brick")
* @returns A hex color string (e.g., "#7d7d7d")
*/
static getCustomBlockFallbackColor(blockTypeId: string): string;
}