mapToRecipeMap

Builds a Map<CoordinateComponent, CMatter> from an inverted mapping of matter to coordinates.

This is the inverse of the layout used in recipeMapFromStringList: instead of specifying where each slot goes, you declare which coordinates each CMatter occupies. All coordinates must be within the valid crafting grid range (x: 0–5, y: 0–5). Returns an empty map if source is empty.

// Example — 3×3 shaped recipe (ring pattern)
val source = mapOf(
CMatterImpl.of(Material.GOLD_BLOCK) to setOf(
CoordinateComponent(0, 0), CoordinateComponent(1, 0), CoordinateComponent(2, 0),
CoordinateComponent(0, 1), CoordinateComponent(2, 1),
CoordinateComponent(0, 2), CoordinateComponent(1, 2), CoordinateComponent(2, 2),
),
CMatterImpl.of(Material.APPLE) to setOf(CoordinateComponent(1, 1))
)
val recipeMap = CoordinateComponent.mapToRecipeMap(source)
// G: GOLD_BLOCK, A: APPLE
// G,G,G
// G,A,G
// G,G,G

Return

Map Mapping of coordinates to matters. Empty if source is empty.

Since

5.0.17-p1

Parameters

source

Mapping of CMatter to the set of grid coordinates it occupies.

Throws

If any coordinate has x or y outside the range 0–5.