Class AnimatedItem.Builder
java.lang.Object
me.gamercoder215.starcosmetics.api.cosmetics.AnimatedItem.Builder
- Enclosing class:
- AnimatedItem
Represents a Builder for Animated Hat Data.
-
Method Summary
Modifier and TypeMethodDescription@NotNull AnimatedItem.BuilderAdds a frame to this Animated Hat Data.@NotNull AnimatedItem.BuilderAdds a frame to this Animated Hat Data.@NotNull AnimatedItem.BuilderAdds a frame to this Animated Hat Data.@NotNull AnimatedItembuild()Builds a new Animated Hat Data with the given frames.function(@NotNull BiConsumer<Player, ItemStack> function) Sets the function to run when starting this Animated Hat.@NotNull AnimatedItem.BuilderSets a frame in this Animated Hat Data.@NotNull AnimatedItem.BuildersetFrames(@NotNull Collection<Map.Entry<Long, ItemStack>> frames) Clears and sets the frames for this Animated Hat Data.
-
Method Details
-
function
Sets the function to run when starting this Animated Hat.- Parameters:
function- function to run- Returns:
- this class, for chaining
-
setFrames
@NotNull public @NotNull AnimatedItem.Builder setFrames(@NotNull @NotNull Collection<Map.Entry<Long, ItemStack>> frames) Clears and sets the frames for this Animated Hat Data.- Parameters:
frames- the frames to set- Returns:
- this class, for chaining
-
addFrames
@NotNull public @NotNull AnimatedItem.Builder addFrames(@NotNull @NotNull Iterable<? extends Map.Entry<Long, ItemStack>> frames) Adds a frame to this Animated Hat Data.- Parameters:
frames- list of frames to add- Returns:
- this class, for chaining
-
addFrame
Adds a frame to this Animated Hat Data.- Parameters:
duration- duration of frame, in ticksitem- itemstack hat of frame- Returns:
- this class, for chaining
-
addFrame
Adds a frame to this Animated Hat Data.- Parameters:
index- index to add frame atduration- duration of frame, in ticksitem- itemstack hat of frame- Returns:
- this class, for chaining
-
setFrame
Sets a frame in this Animated Hat Data.- Parameters:
duration- duration of frame, in ticksitem- itemstack hat of frameindex- index to set frame at- Returns:
- this class, for chaining
-
build
Builds a new Animated Hat Data with the given frames.- Returns:
- Built AnimatedHatData
- Throws:
IllegalStateException- if there are less than 2 frames
-