Перейти к основному содержанию

RenderMesh

Class representing a set of vertices with some other parameters required to display them correctly. Used as block, entity and item models, in animations and actually anywhere you need some physical shape.

Index

Constructors

constructor

Methods

addMesh

  • addMesh(mesh: RenderMesh): void
  • addMesh(mesh: RenderMesh, addX: number, addY: number, addZ: number): void
  • addMesh(mesh: RenderMesh, addX: number, addY: number, addZ: number, scaleX: number, scaleY: number, scaleZ: number): void
  • Adds new mesh to the current one on the specified coordinates.

    @since

    2.0.2b23


    Parameters

    Returns void

addVertex

  • addVertex(x: number, y: number, z: number): void
  • addVertex(x: number, y: number, z: number, u: number, v: number): void
  • Adds a new vertex on the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

clear

  • clear(): void
  • Removes all vertices of the mesh.


    Returns void

clone

fitIn

  • fitIn(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): void
  • fitIn(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, keepRatio: boolean): void
  • Scales the mesh to fit into the specified box.

    @since

    2.0.2b26


    Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number

    Returns void

getPtr

  • getPtr(): number

  • Returns number

    Pointer to the native object instance of the following RenderMesh, represented as long number.

getReadOnlyVertexData

importFromFile

  • importFromFile(path: string, type: obj, importParams: ImportParams): void
  • Imports mesh file using specified path.


    Parameters

    • path: string

      path to the mesh file. Path should be absolute path or be relative to the resources folder or to the "models/" folder

    • type: obj

      file type to read mesh from. The only currently supported mesh file type is "obj"

    • importParams: ImportParams

      additional import parameters or null, if not needed

    Returns void

invalidate

  • invalidate(): void
  • Returns void

newGuiRenderMesh

rebuild

  • rebuild(): void
  • Forces Minecraft to rebuild specified RenderMesh object.


    Returns void

resetColor

  • resetColor(): void
  • Resets color applied to the mesh.


    Returns void

resetTexture

  • resetTexture(): void
  • Resets texture of the mesh.


    Returns void

rotate

  • rotate(x: number, y: number, z: number, rotX: number, rotY: number, rotZ: number): void
  • rotate(rotX: number, rotY: number, rotZ: number): void
  • Rotates the mesh around the specified coordinates.

    @since

    2.0.2b26


    Parameters

    • x: number
    • y: number
    • z: number
    • rotX: number

      rotation angle along X axis, in radians

    • rotY: number

      rotation angle along Y axis, in radians

    • rotZ: number

      rotation angle along Z axis, in radians

    Returns void

scale

  • scale(x: number, y: number, z: number): void
  • Scales the whole mesh along the three axis.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setBlockTexture

  • setBlockTexture(textureName: string, textureMeta: number): void
  • Specifies block texture to be used by mesh.


    Parameters

    • textureName: string
    • textureMeta: number

    Returns void

setColor

  • setColor(r: number, g: number, b: number): void
  • setColor(r: number, g: number, b: number, a: number): void
  • Specifies color to be applied to the next vertices. If the color is not white and the texture is applied to mesh, texture's colors will be affected.


    Parameters

    • r: number
    • g: number
    • b: number

    Returns void

setFoliageTinted

  • setFoliageTinted(): void
  • setFoliageTinted(leavesType: number): void
  • Makes specified RenderMesh foliage tinted.

    @since

    2.0.2b24


    Returns void

setGrassTinted

  • setGrassTinted(): void
  • Makes specified RenderMesh grass tinted.

    @since

    2.0.2b24


    Returns void

setLightDir

  • setLightDir(x: number, y: number, z: number): void
  • Sets following RenderMesh light direction.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setLightIgnore

  • setLightIgnore(ignore: boolean, bool2: boolean): void
  • Parameters

    • ignore: boolean
    • bool2: boolean

    Returns void

setLightParams

  • setLightParams(float1: number, float2: number, float3: number): void
  • Parameters

    • float1: number
    • float2: number
    • float3: number

    Returns void

setLightPos

  • setLightPos(x: number, y: number, z: number): void
  • Sets following RenderMesh light position.

    @since

    2.0.2b25


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setNoTint

  • setNoTint(): void
  • Removes any tint from specified RenderMesh.

    @since

    2.0.2b24


    Returns void

setNormal

  • setNormal(x: number, y: number, z: number): void
  • Specifies the normal vector for the next vertices.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setWaterTinted

  • setWaterTinted(): void
  • Makes specified RenderMesh water tinted.

    @since

    2.0.2b24


    Returns void

translate

  • translate(x: number, y: number, z: number): void
  • Translates the whole mesh along three axis.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void