Interface RenderMaterial
A material instance is always immutable and thread-safe. References to a material remain valid until the end of the current game session.
Materials can be registered and shared between mods using Renderer.registerMaterial(net.minecraft.util.Identifier, RenderMaterial)
.
The registering mod is responsible for creating each registered material at startup.
Materials are not required to know their registration identity, and two materials with the same attributes may or may not satisfy equality and identity tests. Model implementations should never attempt to analyze materials or implement control logic based on them. They are only tokens for communicating quad attributes to the ModelRenderer.
There are three classes of materials...
STANDARD MATERIALS
Standard materials have "normal" rendering with control over lighting, color, and texture blending. In the default renderer, "normal" rendering emulates unmodified Minecraft. Other renderers may offer a different aesthetic.
The number of standard materials is finite, but not necessarily small.
To find a standard material, use Renderer.materialFinder()
.
All renderer implementations should support standard materials.
SPECIAL MATERIALS
Special materials are implemented directly by the Renderer implementation, typically
with the aim of providing advanced/extended features. Such materials may offer additional
vertex attributes via extensions to MeshBuilder
and MutableQuadView
.
Special materials can be obtained using Renderer.materialById(Identifier)
with a known identifier. Renderers may provide other means of access. Popular
special materials could be implemented by multiple renderers, however there is
no requirement that special materials be cross-compatible.
-
Field Summary
Modifier and TypeFieldDescriptionstatic net.minecraft.util.Identifier
This will be identical to the material that would be obtained by callingMaterialFinder.find()
on a new, unaltered,MaterialFinder
instance. -
Method Summary
Modifier and TypeMethodDescriptionint
How many sprite color/uv coordinates are in the material.
-
Field Details
-
MATERIAL_STANDARD
static final net.minecraft.util.Identifier MATERIAL_STANDARDThis will be identical to the material that would be obtained by callingMaterialFinder.find()
on a new, unaltered,MaterialFinder
instance. It is defined here for clarity and convenience.Quads using this material use
RenderLayers.getBlockLayer(BlockState)
of the associated block to determine texture blending, honor block color index, are non-emissive, and apply both diffuse and ambient occlusion shading to vertex colors.All standard, non-fluid baked models are rendered using this material.
-
-
Method Details
-
spriteDepth
int spriteDepth()How many sprite color/uv coordinates are in the material. Behavior for values > 1 is currently undefined. SeeMaterialFinder.spriteDepth(int)
-