recipeMapFromStringList

Builds a Map<CoordinateComponent, CMatter> from a list of comma-separated rows and a token-to-matter mapping.

Each element of lines represents one row (y-axis) of the crafting grid. Within a row, tokens are separated by commas and represent individual slots (x-axis). Each token is looked up in map; tokens not present in map are silently skipped, which can be used to represent empty slots.

Constraints:

  • lines size must be in range 1 to 6 (each row maps to y = 0–5).

  • Each row's token count must be in range 1 to 6 (each token maps to x = 0–5).

  • If lines or map is empty, returns an empty map without throwing.

// Example — 3×3 shaped recipe
val lines = listOf(
"g,g,g",
"g,a,g",
"g,g,g"
)
val map = mapOf(
"a" to CMatterImpl.of(Material.APPLE),
"g" to CMatterImpl.of(Material.GOLD_BLOCK)
)
val recipeMap = CoordinateComponent.recipeMapFromStringList(lines, map)
// CoordinateComponent(0,0)→GOLD_BLOCK CoordinateComponent(1,0)→GOLD_BLOCK CoordinateComponent(2,0)→GOLD_BLOCK
// CoordinateComponent(0,1)→GOLD_BLOCK CoordinateComponent(1,1)→APPLE CoordinateComponent(2,1)→GOLD_BLOCK
// CoordinateComponent(0,2)→GOLD_BLOCK CoordinateComponent(1,2)→GOLD_BLOCK CoordinateComponent(2,2)→GOLD_BLOCK
// Example 2 — token not in map is skipped (acts as an empty slot)
val lines = listOf(
"a,a",
"_,a" // "_" is not a key in map, so (0,1) is skipped
)
val map = mapOf("a" to CMatterImpl.of(Material.APPLE))
val recipeMap = CoordinateComponent.recipeMapFromStringList(lines, map)
// CoordinateComponent(0,0)→APPLE CoordinateComponent(1,0)→APPLE
// CoordinateComponent(1,1)→APPLE

Return

Map Mapping of coordinates to matters. Empty if lines or map is empty.

Since

5.0.17-p1

Parameters

lines

Comma-separated row strings. Size must be 1 to 6.

map

Mapping of token strings to CMatter instances.

Throws

If lines size exceeds 6, or any row's token count exceeds 6.