toJson

@Nullable
open fun toJson(@NotNull resolution: @NotNull ModelResolution): @Nullable JsonObject

Serializes this UV mapping into a Minecraft model face JsonObject.

Scales and normalizes the UV coordinates based on the given ModelResolution. If the normalized coordinates are invalid, returns null.

Return

the serialized JSON representation of this face, or null if the UV is invalid

Since

3.7.0

Parameters

resolution

the texture resolution used to normalize UV coordinates


@Nullable
open fun toJson(@NotNull uvs: @NotNull List<BlueprintUV>, @NotNull function: @NotNull (BlueprintUV) -> ModelResolution): @Nullable JsonObject

Serializes a list of BlueprintUV instances into a combined JSON object representing the "faces" section of a Minecraft element JSON.

Return

a JsonObject containing each face mapped to its serialized UV object, or null if all mappings are omitted or invalid

Since

3.7.0

Parameters

uvs

the list of UV mappings to serialize

function

the mapper of the texture resolution used to normalize UV coordinates