Class ElementBuilder
java.lang.Object
net.neoforged.neoforge.client.model.generators.template.ElementBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private int
private final Map
<net.minecraft.core.Direction, FaceBuilder> private org.joml.Vector3f
private boolean
private int
private @Nullable RotationBuilder
private boolean
private int
private org.joml.Vector3f
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BiConsumer
<net.minecraft.core.Direction, FaceBuilder> addTexture
(net.minecraft.client.data.models.model.TextureSlot texture) allFaces
(BiConsumer<net.minecraft.core.Direction, FaceBuilder> action) Modify all possible faces dynamically using a function, creating new faces as necessary.allFacesExcept
(BiConsumer<net.minecraft.core.Direction, FaceBuilder> action, Set<net.minecraft.core.Direction> exc) Creates possible faces for the model as needed, excluding those specified in the second argument, and then applies a function to modify added faces.ambientOcclusion
(boolean ambientOcclusion) Set the ambient occlusion of the element.(package private) net.minecraft.client.renderer.block.model.BlockElement
build()
color
(int color) Sets the color of the element.(package private) ElementBuilder
copy()
cube
(net.minecraft.client.data.models.model.TextureSlot texture) Create a typical cube element, creating new faces as needed, applying the given texture, and setting the cullface.emissivity
(int blockLight, int skyLight) Set the block and sky light of the element (0-15).face
(net.minecraft.core.Direction dir, Consumer<FaceBuilder> action) Return or create the face builder for the given direction.faces
(BiConsumer<net.minecraft.core.Direction, FaceBuilder> action) Modify all existing faces dynamically using a function.from
(float x, float y, float z) Set the "from" position for this element.lightEmission
(int lightEmission) Set the light emission of the element (0-15)rotation
(Consumer<RotationBuilder> action) Allows modifying the rotation for this element.shade
(boolean shade) Sets whether or not this element should be shaded.texture
(net.minecraft.client.data.models.model.TextureSlot texture) Texture all existing faces in the current element with the given texture.textureAll
(net.minecraft.client.data.models.model.TextureSlot texture) Texture all possible faces in the current element with the given texture, creating new faces where necessary.to
(float x, float y, float z) Set the "to" position for this element.private static void
validateCoordinate
(float coord, char name) private static void
validatePosition
(org.joml.Vector3f pos)
-
Field Details
-
from
private org.joml.Vector3f from -
to
private org.joml.Vector3f to -
faces
-
rotation
-
shade
private boolean shade -
lightEmission
private int lightEmission -
color
private int color -
blockLight
private int blockLight -
skyLight
private int skyLight -
hasAmbientOcclusion
private boolean hasAmbientOcclusion
-
-
Constructor Details
-
ElementBuilder
public ElementBuilder()
-
-
Method Details
-
from
Set the "from" position for this element.- Parameters:
x
- x-position for this vectory
- y-position for this vectorz
- z-position for this vector- Returns:
- this builder
- Throws:
IllegalArgumentException
- if the vector is out of bounds (any coordinate not between -16 and 32, inclusive)
-
to
Set the "to" position for this element.- Parameters:
x
- x-position for this vectory
- y-position for this vectorz
- z-position for this vector- Returns:
- this builder
- Throws:
IllegalArgumentException
- if the vector is out of bounds (any coordinate not between -16 and 32, inclusive)
-
face
Return or create the face builder for the given direction.- Parameters:
dir
- the direction- Returns:
- the face builder for the given direction
- Throws:
NullPointerException
- ifdir
isnull
-
rotation
Allows modifying the rotation for this element. -
shade
Sets whether or not this element should be shaded. -
allFaces
Modify all possible faces dynamically using a function, creating new faces as necessary.- Parameters:
action
- the function to apply to each direction- Returns:
- this builder
- Throws:
NullPointerException
- ifaction
isnull
-
allFacesExcept
public ElementBuilder allFacesExcept(BiConsumer<net.minecraft.core.Direction, FaceBuilder> action, Set<net.minecraft.core.Direction> exc) Creates possible faces for the model as needed, excluding those specified in the second argument, and then applies a function to modify added faces.- Parameters:
action
- the function to apply to each directionexc
- directions which will be excluded from adding to model file- Returns:
- this builder
- Throws:
NullPointerException
- ifaction
isnull
-
faces
Modify all existing faces dynamically using a function.- Parameters:
action
- the function to apply to each direction- Returns:
- this builder
- Throws:
NullPointerException
- ifaction
isnull
-
textureAll
Texture all possible faces in the current element with the given texture, creating new faces where necessary.- Parameters:
texture
- the texture- Returns:
- this builder
- Throws:
NullPointerException
- iftexture
isnull
-
texture
Texture all existing faces in the current element with the given texture.- Parameters:
texture
- the texture- Returns:
- this builder
- Throws:
NullPointerException
- iftexture
isnull
-
cube
Create a typical cube element, creating new faces as needed, applying the given texture, and setting the cullface.- Parameters:
texture
- the texture- Returns:
- this builder
- Throws:
NullPointerException
- iftexture
isnull
-
emissivity
Set the block and sky light of the element (0-15). Traditional "emissivity" values were set both of these to the same value.- Parameters:
blockLight
- the block lightskyLight
- the sky light- Returns:
- this builder
-
lightEmission
Set the light emission of the element (0-15)If block and sky light values should be different, use
emissivity(int, int)
instead- Parameters:
lightEmission
- the light value- Returns:
- this builder
-
color
Sets the color of the element.- Parameters:
color
- the color in ARGB format.- Returns:
- this builder
-
ambientOcclusion
Set the ambient occlusion of the element.- Parameters:
ambientOcclusion
- the ambient occlusion- Returns:
- this builder
-
addTexture
private static BiConsumer<net.minecraft.core.Direction,FaceBuilder> addTexture(net.minecraft.client.data.models.model.TextureSlot texture) -
validateCoordinate
private static void validateCoordinate(float coord, char name) -
validatePosition
private static void validatePosition(org.joml.Vector3f pos) -
build
net.minecraft.client.renderer.block.model.BlockElement build() -
copy
ElementBuilder copy()
-