Skip to content

@loontail/minecraft-kit v0.8.14 / asMinecraftVersionId

Function: asMinecraftVersionId()

ts
function asMinecraftVersionId(raw): MinecraftVersionId

Validate raw as a Minecraft version id and brand it as MinecraftVersionId. Throws MinecraftKitError(INVALID_INPUT) when the input is empty after trimming. Version ids span vanilla ("1.20.1"), snapshot ("24w14a"), and loader-flavoured shapes ("fabric-loader-0.14.21-1.20.1", "1.20.1-forge-47.2.0"), so the constructor only enforces non-emptiness — the resolver decides whether the id actually corresponds to a published version.

Parameters

ParameterType
rawstring

Returns

MinecraftVersionId

Example

ts
import { asMinecraftVersionId } from "@loontail/minecraft-kit";

const id = asMinecraftVersionId("1.20.1");
await kit.versions.minecraft.resolve({ version: id });

Source

src/core/version-id.ts:21

MIT License