Reference Source
import SkinRender from 'minerender/src/skin/index.js'
public class | source

SkinRender

Extends:

Render → SkinRender

A renderer for Minecraft player models/skins

Constructor Summary

Public Constructor
public

constructor(options: Object, element: HTMLElement)

Member Summary

Public Members
public
public
Private Members
private

_animId: *

private
private

Method Summary

Public Methods
public

getModelByName(name: *): *

public
public

render(texture: string | Object, cb: function)

Does the actual rendering

public

reset()

public

resize(width: *, height: *): *

public

toggleSkinPart(name: *, visible: *)

Inherited Summary

From class Render
public

element: HTMLElement

DOM Element to attach the renderer to

public

options: {

Combined options

public
public

addToScene(toAdd: *)

Adds an object to the scene & sets userData.renderType to this renderer's type

public

clearScene(onlySelfType: *)

Clears the scene

public
public

toGLTF(exportOptions: *): Promise<any>

Export the current scene content in the .gltf format (geometries + textures)

public

toImage(trim: boolean, mime: string): string

public

Export the current scene content in the .obj format (only geometries, no textures)

public

toPLY(exportOptions: *): *

protected

initScene(renderCb: *, doNotAnimate: *): boolean

Initializes the scene

Public Constructors

public constructor(options: Object, element: HTMLElement) source

Override:

Render#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional

The options for this renderer, see defaultOptions

element HTMLElement
  • optional
  • default: document.body

DOM Element to attach the renderer to - defaults to document.body

Public Members

public attached: boolean source

public renderType: string source

Override:

Render#renderType

Private Members

private _animId: * source

private _capeImage: * source

private _skinImage: * source

Public Methods

public getModelByName(name: *): * source

Params:

NameTypeAttributeDescription
name *

Return:

*

public getPlayerModel(): * source

Return:

*

public render(texture: string | Object, cb: function) source

Does the actual rendering

Params:

NameTypeAttributeDescription
texture string | Object

The texture to render - May be a string with the playername/URL/Base64 or an Object

texture.url string

URL to the texture image

texture.data string

Base64 encoded image data of the texture

texture.username string

Player username

texture.uuid string

Player UUID

texture.mineskin number

ID of a MineSkin.org skin

texture.slim boolean
  • optional
  • default: false

Whether the provided texture uses the slim skin format

texture.capeUrl string
  • optional

URL to a cape texture

texture.capeData string
  • optional

Base64 encoded image data of the cape texture

texture.mineskin string
  • optional

ID of a MineSkin.org skin with a cape

texture.optifine boolean
  • optional
  • default: false

Whether the provided cape texture is an optifine cape

cb function
  • optional

Callback when rendering finished

public reset() source

public resize(width: *, height: *): * source

Params:

NameTypeAttributeDescription
width *
height *

Return:

*

public toggleSkinPart(name: *, visible: *) source

Params:

NameTypeAttributeDescription
name *
visible *