Skip to main content

Module blocks3d

Module blocks3d 

Source
Expand description

draw2d_blocks in the designer: blocks in 3D, as the game draws them in a GUI (an orthographic view, turned and tilted), each block a cube with its model’s boxes (elements: a cable’s core, a slab’s half) with their textures — the faces you’d see, back to front, the top lit, the sides shaded like Minecraft’s. A model without elements is a cube. A block state picks its blockstate’s variant (turned by its x/y) or every multipart part whose when it meets; elements keep their own rotations.

Structs§

Cuboid
One box of a model, in sixteenths of a block: per face (up, down, north, south, west, east) its texture, already cut to the face’s uv (None: the box has no such face), and the turns it’s drawn with, in order (its element’s, then its variant’s).
Turn
A turn of a box about axis (0 x, 1 y, 2 z) through origin (sixteenths of a block), degrees counter-clockwise looking down the axis; rescale stretches the turned box’s other axes back to the block (an element’s rescale).

Constants§

FACE_TEXTURES
The texture variables the game’s block models draw each face with (in [FACE_NAMES] order), most particular first: a cube’s up, a column’s end, a cube_all’s all, a one-texture model’s texture.

Functions§

cube
A whole-block cube with faces (a missing one: the missing texture).
draw
draw_cube
One cube with its own faces (a mob’s head, say), as draw draws a block.
is_block
Whether id is a block (the game’s, or the mod’s .yblock).
shape_of
A model’s elements as boxes; texture("#var" or "var") gives a face’s texture.

Type Aliases§

Faces
A cube’s textures per face: up, down, north, south, west, east.
Shape
A block as drawn: its model’s boxes.