ModelScaler

interface ModelScaler

Defines how a model's scale is calculated.

Scalers can be constant values, derived from entity attributes, or composites of multiple scalers. They are serializable to JSON for configuration purposes.

Since

1.15.2

Inheritors

Types

Link copied to clipboard
interface Builder
Builder interface for creating Getters from JSON.
Link copied to clipboard
interface BuiltInDeserializer : Function<JsonElement, ModelScaler>
Helper interface for built-in deserializers.
Link copied to clipboard
Implementation of a composite scaler.
Link copied to clipboard
Registry and factory for scalers.
Link copied to clipboard
interface Getter
Functional interface for calculating scale.

Properties

Link copied to clipboard
The global deserializer instance for scalers.

Functions

Link copied to clipboard
@NotNull
open fun composite(@NotNull scaler: @NotNull ModelScaler): @NotNull ModelScaler
Multiplies this scaler by another scaler.
@NotNull
open fun composite(@NotNull scalers: Array<@NotNull ModelScaler>): @NotNull ModelScaler
Creates a composite scaler that multiplies the results of multiple scalers.
Link copied to clipboard
@Nullable
abstract fun data(): @Nullable JsonElement
Returns the configuration data for this scaler as a JSON element.
Link copied to clipboard
@NotNull
open fun defaultScaler(): @NotNull ModelScaler
Returns the default scaler (constant 1.0).
Link copied to clipboard
@NotNull
open fun deserialize(@NotNull element: @NotNull JsonObject): @NotNull ModelScaler
Deserializes a scaler from a JSON object.
Link copied to clipboard
@NotNull
open fun entity(): @NotNull ModelScaler
Returns a scaler that uses the entity's scale attribute.
Link copied to clipboard
@NotNull
open fun multiply(value: Float): @NotNull ModelScaler
Multiplies this scaler by a constant value.
Link copied to clipboard
@NotNull
abstract fun name(): @NotNull String
Returns the name of this scaler type.
Link copied to clipboard
abstract fun scale(@NotNull tracker: @NotNull Tracker): Float
Calculates the scale for a given tracker.
Link copied to clipboard
@NotNull
open fun serialize(): @NotNull JsonObject
Serializes this scaler to a JSON object.
Link copied to clipboard
@NotNull
open fun value(value: Float): @NotNull ModelScaler
Returns a constant value scaler.