Reference Source
import GuiRender from 'minerender/src/gui/index.js'
public class | source

GuiRender

Extends:

Render → GuiRender

A renderer for Minecraft GUIs

Constructor Summary

Public Constructor
public

constructor(options: Object, element: HTMLElement)

Member Summary

Public Members
public
public

gui: *

public

Method Summary

Public Methods
public

render(layers: string[] | Object[], cb: function)

Does the actual rendering

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: *, filterFn: *)

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

options.assetRoot string
  • optional
  • default: DEFAULT_ROOT

root to get asset files from

element HTMLElement
  • optional
  • default: document.body

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

Public Members

public attached: boolean source

public gui: * source

public renderType: string source

Override:

Render#renderType

Public Methods

public render(layers: string[] | Object[], cb: function) source

Does the actual rendering

Params:

NameTypeAttributeDescription
layers string[] | Object[]

Array of GUI layers - either strings or objects

layers[].texture string

path to the layer's texture (starting at assets/minecraft/textures/), e.g. '/items/apple'

layers[].textureScale number
  • optional
  • default: 1

scale of the given texture, can be used to get different sized textures aligned proerly

layers[].uv number[]
  • optional

[x1,y1,x2,y2] array UV mapping of the texture

layers[].pos number[]
  • optional
  • default: [0,0]

[x,y] array position of the layer

cb function
  • optional

Callback when rendering finished