Interface FabricClientAudiences.Builder
- Enclosing interface:
- FabricClientAudiences
FabricClientAudiences
instance.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull FabricClientAudiences
build()
Builds the provider.default <T> @NotNull FabricClientAudiences.Builder
componentRenderer
(@NotNull Function<Pointered, T> partition, @NotNull ComponentRenderer<T> componentRenderer) Sets the component renderer and partition function for the provider.@NotNull FabricClientAudiences.Builder
componentRenderer
(@NotNull ComponentRenderer<Pointered> componentRenderer) Sets the component renderer for the provider.@NotNull FabricClientAudiences.Builder
Set the partition function for the provider.
-
Method Details
-
componentRenderer
@NotNull @NotNull FabricClientAudiences.Builder componentRenderer(@NotNull @NotNull ComponentRenderer<Pointered> componentRenderer) Sets the component renderer for the provider.- Parameters:
componentRenderer
- a component renderer- Returns:
- this builder
- Since:
- 4.0.0
- See Also:
-
partition
@NotNull @NotNull FabricClientAudiences.Builder partition(@NotNull @NotNull Function<Pointered, ?> partitionFunction) Set the partition function for the provider.The output of the function must have
Object.equals(Object)
andObject.hashCode()
methods overridden to ensure efficient operation.The output of the partition function must also be something suitable for use as a map key and as such, for long-term storage. This excludes objects that may hold live game state like
Entity
orLevel
.The configured
component renderer
must produce the same result for twoPointered
instances where this partition function provides the same output. If this condition is violated, caching issues are likely to occur, producing incorrect output for at least one of the inputs.A local
record
is a good way to produce a compound output value for this function.- Parameters:
partitionFunction
- the partition function to apply- Returns:
- this builder
- Since:
- 4.0.0
- See Also:
-
componentRenderer
@NotNull default <T> @NotNull FabricClientAudiences.Builder componentRenderer(@NotNull @NotNull Function<Pointered, T> partition, @NotNull @NotNull ComponentRenderer<T> componentRenderer) Sets the component renderer and partition function for the provider.This variant validates that the component renderer only depends on information included in the partition.
- Type Parameters:
T
- the type used in the partition function- Parameters:
partition
- the partition function to use on this providercomponentRenderer
- a component renderer- Returns:
- this builder
- Since:
- 4.0.0
-
build
Builds the provider.- Returns:
- the built provider
- Since:
- 4.0.0
-