1.0.10 • Published 2 months ago

starlightskinapi v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Starlight SkinAPI Wrapper

This package is a Starlight SkinAPI wrapper

Oficial Starlight SkinAPI Documentation : https://docs.lunareclipse.studio/

Installation

npm install starlightskinapi

fetchSkinInfo function usage:

import { fetchSkinInfo } from "starlightskinapi";

async function main(){
    const playerNickname = "RinckoZ_";
    const infoResult = await fetchSkinInfo(playerNickname)

    if (infoResult.success){
        console.log(infoResult.playerUUID)
        console.log(infoResult.skinUrl)
        console.log(infoResult.userCape)
        console.log(infoResult.skinTextureWidth)
        console.log(infoResult.skinTextureHeight)
    }
}
main();

Output:

f169e30f110943dfba445da3b7dee1ce
http://textures.minecraft.net/texture/4d24cc4874ba673963ca57818a0be02666aa80f4747d00b45571e380ed9b54f7
http://textures.minecraft.net/texture/2340c0e03dd24a11b15a8b33c2a7e9e32abb2051b2481d0ba7defd635ca7a933
64
64

If the nick or uuid is not found, success will be false, and you will have the error property

async function main(){
    const playerNickname = "NicknameVeryLongAndUnlikely";
    const infoResult = await fetchSkinInfo(playerNickname)

    if (!infoResult.success){
        console.log(infoResult.error)
    }
}
main();

Output:

Unknown player username/uuid.

See how to get a render pose

import { RenderCrops, RenderTypes, fetchSkinRender } from "starlightskinapi";
import { writeFile } from "node:fs/promises"

async function main(){
    const playerNickname = "RinckoZ_";
    const renderResult = await fetchSkinRender(playerNickname, {
        type: RenderTypes.Default,
        crop: RenderCrops.Full,
    })

    if (!renderResult.success){
        console.log(renderResult.error)
        return;
    }

    if (renderResult.success){
        const { buffer, url } = renderResult;
        console.log(url) // 
        await writeFile("./render.png", buffer);
    }
}
main();

Output:

You can customize the model, camera and lighting options

import { RenderCrops, RenderTypes, fetchSkinRender } from "starlightskinapi";
import { writeFile } from "node:fs/promises"

async function main(){
    const playerNickname = "RinckoZ_";

    const renderResult = await fetchSkinRender(playerNickname, {
        type: RenderTypes.Default,
        crop: RenderCrops.Full,
        model: {
            capeEnabled: true,
            // ... other model options ...
        },
        camera: {
            cameraPosition: { x: "10", y: "10", z: "-20" },
            cameraWidth: 720,
            cameraHeight: 1080,
            // ... other camera options ...
        },
        lighting: {
            dirLightPos: { x: "-10", y: "10", z: "-10" },
            // ... other lighting options ...
        },
    });

    if (!renderResult.success){
        console.log(renderResult.error)
        return;
    }

    if (renderResult.success){
        const { buffer } = renderResult;
        await writeFile("./customized.png", buffer);
    }
}
main();

Output:

Full Render Type List

Render TypesSupported CropsPreview
DefaultFull, Bust, Face
MarchingFull, Bust, Face
WalkingFull, Bust, Face
CrouchingFull, Bust, Face
CrossedFull, Bust, Face
CrissCrossFull, Bust, Face
CheeringFull, Bust, Face
RelaxingFull, Bust, Face
TrudgingFull, Bust, Face
CoweringFull, Bust, Face
PointingFull, Bust, Face
LungingFull, Bust, Face
DungeonsFull, Bust, Face
FacepalmFull, Bust, Face
SleepingFull, Bust
DeadFull, Bust, Face
ArcherFull, Bust, Face
FacepalmFull, Bust, Face
MojavatarFull, Bust
UltimateFull, Bust, Face
IsometricFull, Bust, Face
HeadFull
BitzelFull, Bust, Face
PixelFull, Bust, Face
OrnamentFull
SkinDefault, Processed
1.0.10

2 months ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago