Class ElementBuilder
java.lang.Object
net.neoforged.neoforge.client.model.generators.template.ElementBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate final Map<Direction, FaceBuilder> private Vector3fprivate booleanprivate intprivate @Nullable RotationBuilderprivate booleanprivate intprivate Vector3f -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BiConsumer<Direction, FaceBuilder> addTexture(TextureSlot texture) allFaces(BiConsumer<Direction, FaceBuilder> action) Modify all possible faces dynamically using a function, creating new faces as necessary.allFacesExcept(BiConsumer<Direction, FaceBuilder> action, Set<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) BlockElementbuild()color(int color) Sets the color of the element.(package private) ElementBuildercopy()cube(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(Direction dir, Consumer<FaceBuilder> action) Return or create the face builder for the given direction.faces(BiConsumer<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(TextureSlot texture) Texture all existing faces in the current element with the given texture.textureAll(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 voidvalidateCoordinate(float coord, char name) private static voidvalidatePosition(Vector3f pos)
-
Field Details
-
from
-
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- ifdirisnull
-
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- ifactionisnull
-
allFacesExcept
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- ifactionisnull
-
faces
Modify all existing faces dynamically using a function.- Parameters:
action- the function to apply to each direction- Returns:
- this builder
- Throws:
NullPointerException- ifactionisnull
-
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- iftextureisnull
-
texture
Texture all existing faces in the current element with the given texture.- Parameters:
texture- the texture- Returns:
- this builder
- Throws:
NullPointerException- iftextureisnull
-
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- iftextureisnull
-
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
-
validateCoordinate
private static void validateCoordinate(float coord, char name) -
validatePosition
-
build
BlockElement build() -
copy
ElementBuilder copy()
-