Interface ColorProvider
- All Known Implementing Classes:
AbstractGradient, BilinearGradient, CheckeredPattern, GridPattern, LinearGradient, NoiseGradient, RadialGradient, StripedPattern, SweepGradient, VoronoiPattern, WaveGradient
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface representing a procedural color source.
A ColorProvider determines a Color based on a 3D spatial position
and a temporal progress value. It serves as the base for all gradients,
procedural patterns, and dynamic color animations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ColorProviderbilinear(org.bukkit.Color c00, org.bukkit.Color c10, org.bukkit.Color c01, org.bukkit.Color c11, double scaleX, double scaleZ) Creates a bilinear gradient provider for 2D surface interpolation.static ColorProvidercheckered(org.bukkit.Color c1, org.bukkit.Color c2, double size) Creates a 3D checkerboard pattern.default ColorProviderfilter(ColorFilter filter) Wraps this provider with aColorFilter.static ColorProviderfixed(org.bukkit.Color color) Creates a provider that always returns the same static color.default org.bukkit.Colorget(double progress) Samples a color based purely on progress, using a default vector.org.bukkit.Colorget(org.bukkit.util.Vector position, double progress) Samples a color at the specified 3D position and animation progress.static ColorProvidergrid(org.bukkit.Color bg, org.bukkit.Color line, double size, double thickness) Creates a grid pattern.static ColorProviderCreates a linear gradient provider from a list.static ColorProviderlinear(org.bukkit.Color... colors) Creates a linear gradient provider.static ColorProvidernoise(ColorProvider base, double freq) Wraps a provider with Perlin noise to create organic, smoky transitions.static ColorProviderradial(double radius, org.bukkit.Color... colors) Creates a radial gradient provider originating from the center.static ColorProviderrainbow()Creates a dynamic rainbow provider that cycles through hues over the progress value.static ColorProviderstriped(org.bukkit.Color c1, org.bukkit.Color c2, double width, org.bukkit.util.Vector dir) Creates a striped pattern along a specific direction.static ColorProvidersweep(org.bukkit.Color... colors) Creates a sweep gradient provider that rotates around the center.static ColorProvidervoronoi(org.bukkit.Color[] palette, int density, double scale) Creates a cellular Voronoi pattern.static ColorProviderwave(ColorProvider base, org.bukkit.util.Vector dir, double waveLength, double speed) Modulates a provider with a sine wave based on position and time.
-
Method Details
-
get
org.bukkit.Color get(org.bukkit.util.Vector position, double progress) Samples a color at the specified 3D position and animation progress.- Parameters:
position- The spatialVectorrepresenting where to sample the color.progress- A normalized value (usually 0.0 to 1.0) representing time or completion.- Returns:
- The resulting
Color.
-
get
default org.bukkit.Color get(double progress) Samples a color based purely on progress, using a default vector.- Parameters:
progress- The normalized progress value.- Returns:
- The resulting
Color.
-
filter
Wraps this provider with aColorFilter.- Parameters:
filter- The filter to apply to the output of this provider.- Returns:
- A new
ColorProviderthat returns filtered colors.
-
fixed
Creates a provider that always returns the same static color.- Parameters:
color- TheColorto return.- Returns:
- A fixed color provider.
-
rainbow
Creates a dynamic rainbow provider that cycles through hues over the progress value.- Returns:
- A rainbow
ColorProvider.
-
linear
Creates a linear gradient provider.- Parameters:
colors- The color stops for the gradient.- Returns:
- A
LinearGradientinstance.
-
linear
Creates a linear gradient provider from a list.- Parameters:
colors- The list of color stops.- Returns:
- A
LinearGradientinstance.
-
radial
Creates a radial gradient provider originating from the center.- Parameters:
radius- The radius at which the gradient completes.colors- The color stops for the gradient.- Returns:
- A
RadialGradientinstance.
-
sweep
Creates a sweep gradient provider that rotates around the center.- Parameters:
colors- The color stops for the gradient.- Returns:
- A
SweepGradientinstance.
-
bilinear
static ColorProvider bilinear(org.bukkit.Color c00, org.bukkit.Color c10, org.bukkit.Color c01, org.bukkit.Color c11, double scaleX, double scaleZ) Creates a bilinear gradient provider for 2D surface interpolation.- Parameters:
c00- Color at (0,0).c10- Color at (1,0).c01- Color at (0,1).c11- Color at (1,1).scaleX- The width of the gradient cycle.scaleZ- The depth of the gradient cycle.- Returns:
- A
BilinearGradientinstance.
-
noise
Wraps a provider with Perlin noise to create organic, smoky transitions.- Parameters:
base- The base provider to sample from.freq- The frequency of the noise.- Returns:
- A
NoiseGradientinstance.
-
wave
static ColorProvider wave(ColorProvider base, org.bukkit.util.Vector dir, double waveLength, double speed) Modulates a provider with a sine wave based on position and time.- Parameters:
base- The base provider.dir- The direction of the wave propagation.waveLength- The distance between wave peaks.speed- The rate of wave movement.- Returns:
- A
WaveGradientinstance.
-
checkered
Creates a 3D checkerboard pattern.- Parameters:
c1- The first color.c2- The second color.size- The size of each square.- Returns:
- A
CheckeredPatterninstance.
-
striped
static ColorProvider striped(org.bukkit.Color c1, org.bukkit.Color c2, double width, org.bukkit.util.Vector dir) Creates a striped pattern along a specific direction.- Parameters:
c1- The first stripe color.c2- The second stripe color.width- The width of the stripes.dir- The direction of the stripes.- Returns:
- A
StripedPatterninstance.
-
grid
static ColorProvider grid(org.bukkit.Color bg, org.bukkit.Color line, double size, double thickness) Creates a grid pattern.- Parameters:
bg- The background color.line- The color of the grid lines.size- The spacing between lines.thickness- The thickness of the lines.- Returns:
- A
GridPatterninstance.
-
voronoi
Creates a cellular Voronoi pattern.- Parameters:
palette- The colors available for cells.density- The number of seed points.scale- The coordinate scale.- Returns:
- A
VoronoiPatterninstance.
-