Class ConfiguredModel
- java.lang.Object
-
- net.minecraftforge.client.model.generators.ConfiguredModel
-
public final class ConfiguredModel extends java.lang.ObjectRepresents a model with blockstate configurations, e.g. rotation, uvlock, and random weight.Can be manually constructed, created by static factory such as
allYRotations(ModelFile, int, boolean), or created by builder viabuilder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfiguredModel.Builder<T>A builder forConfiguredModels, which can contain a callback for processing the finished result.
-
Constructor Summary
Constructors Constructor Description ConfiguredModel(ModelFile model)Construct a newConfiguredModelwith the default rotation (0, 0), uvlock (false), anddefault random weight.ConfiguredModel(ModelFile model, int rotationX, int rotationY, boolean uvLock)Construct a newConfiguredModelwith thedefault random weight.ConfiguredModel(ModelFile model, int rotationX, int rotationY, boolean uvLock, int weight)Construct a newConfiguredModel.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConfiguredModel[]allRotations(ModelFile model, boolean uvlock)static ConfiguredModel[]allRotations(ModelFile model, boolean uvlock, int weight)static ConfiguredModel[]allYRotations(ModelFile model, int x, boolean uvlock)static ConfiguredModel[]allYRotations(ModelFile model, int x, boolean uvlock, int weight)static ConfiguredModel.Builder<?>builder()Create a new unownedConfiguredModel.Builder.(package private) static ConfiguredModel.Builder<MultiPartBlockStateBuilder.PartBuilder>builder(MultiPartBlockStateBuilder outer)(package private) static ConfiguredModel.Builder<VariantBlockStateBuilder>builder(VariantBlockStateBuilder outer, VariantBlockStateBuilder.PartialBlockstate state)(package private) static voidcheckRotation(int rotationX, int rotationY)(package private) static voidcheckWeight(int weight)(package private) com.google.gson.JsonObjecttoJSON(boolean includeWeight)private static java.util.stream.IntStreamvalidRotations()
-
-
-
Field Detail
-
DEFAULT_WEIGHT
public static final int DEFAULT_WEIGHT
The default random weight of configured models, used by convenience overloads.- See Also:
- Constant Field Values
-
model
public final ModelFile model
-
rotationX
public final int rotationX
-
rotationY
public final int rotationY
-
uvLock
public final boolean uvLock
-
weight
public final int weight
-
-
Constructor Detail
-
ConfiguredModel
public ConfiguredModel(ModelFile model, int rotationX, int rotationY, boolean uvLock, int weight)
Construct a newConfiguredModel.- Parameters:
model- the underlying modelrotationX- x-rotation to apply to the modelrotationY- y-rotation to apply to the modeluvLock- if uvlock should be enabledweight- the random weight of the model- Throws:
java.lang.NullPointerException- ifmodelisnulljava.lang.IllegalArgumentException- if x and/or y rotation are not valid (seeModelRotation)java.lang.IllegalArgumentException- if weight is less than or equal to zero
-
ConfiguredModel
public ConfiguredModel(ModelFile model, int rotationX, int rotationY, boolean uvLock)
Construct a newConfiguredModelwith thedefault random weight.- Parameters:
model- the underlying modelrotationX- x-rotation to apply to the modelrotationY- y-rotation to apply to the modeluvLock- if uvlock should be enabled- Throws:
java.lang.NullPointerException- ifmodelisnulljava.lang.IllegalArgumentException- if x and/or y rotation are not valid (seeModelRotation)
-
ConfiguredModel
public ConfiguredModel(ModelFile model)
Construct a newConfiguredModelwith the default rotation (0, 0), uvlock (false), anddefault random weight.- Throws:
java.lang.NullPointerException- ifmodelisnull
-
-
Method Detail
-
validRotations
private static java.util.stream.IntStream validRotations()
-
allYRotations
public static ConfiguredModel[] allYRotations(ModelFile model, int x, boolean uvlock)
-
allYRotations
public static ConfiguredModel[] allYRotations(ModelFile model, int x, boolean uvlock, int weight)
-
allRotations
public static ConfiguredModel[] allRotations(ModelFile model, boolean uvlock)
-
allRotations
public static ConfiguredModel[] allRotations(ModelFile model, boolean uvlock, int weight)
-
checkRotation
static void checkRotation(int rotationX, int rotationY)
-
checkWeight
static void checkWeight(int weight)
-
toJSON
com.google.gson.JsonObject toJSON(boolean includeWeight)
-
builder
public static ConfiguredModel.Builder<?> builder()
Create a new unownedConfiguredModel.Builder.- Returns:
- the builder
- See Also:
ConfiguredModel.Builder
-
builder
static ConfiguredModel.Builder<VariantBlockStateBuilder> builder(VariantBlockStateBuilder outer, VariantBlockStateBuilder.PartialBlockstate state)
-
builder
static ConfiguredModel.Builder<MultiPartBlockStateBuilder.PartBuilder> builder(MultiPartBlockStateBuilder outer)
-
-