Interface Sound.Builder

  • All Superinterfaces:
    AbstractBuilder<Sound>
    Enclosing interface:
    Sound

    public static interface Sound.Builder
    extends AbstractBuilder<Sound>
    A builder for sound instances.

    Type is required, all other options are optional.

    Since:
    4.12.0
    • Method Detail

      • type

        @NotNull
        @NotNull Sound.Builder type​(@NotNull
                                    @NotNull Key type)
        Set the type of this sound.

        Required.

        Parameters:
        type - resource location of the sound event to play
        Returns:
        this builder
        Since:
        4.12.0
      • type

        @NotNull
        @NotNull Sound.Builder type​(@NotNull
                                    @NotNull Sound.Type type)
        Set the type of this sound.

        Required.

        Parameters:
        type - a type of sound to play
        Returns:
        this builder
        Since:
        4.12.0
      • type

        @NotNull
        @NotNull Sound.Builder type​(@NotNull
                                    @NotNull java.util.function.Supplier<? extends Sound.Type> typeSupplier)
        Set the type of this sound.

        Required.

        Parameters:
        typeSupplier - a type of sound to play, evaluated lazily
        Returns:
        this builder
        Since:
        4.12.0
      • volume

        @NotNull
        @NotNull Sound.Builder volume​(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) float volume)
        The volume for this sound, indicating how far away it can be heard.

        Default value is 1.

        Parameters:
        volume - the sound volume
        Returns:
        this builder
        Since:
        4.12.0
      • pitch

        @NotNull
        @NotNull Sound.Builder pitch​(@org.jetbrains.annotations.Range(from=-1L, to=1L) float pitch)
        The volume for this sound, indicating how far away it can be heard.

        Default value is 1.

        Parameters:
        pitch - the sound pitch
        Returns:
        this builder
        Since:
        4.12.0
      • seed

        @NotNull
        @NotNull Sound.Builder seed​(long seed)
        The seed for this sound, used for weighted choices.

        The default seed is the world seed of the receiver's current world.

        Parameters:
        seed - the seed
        Returns:
        this builder
        Since:
        4.12.0
      • seed

        @NotNull
        @NotNull Sound.Builder seed​(@NotNull
                                    @NotNull java.util.OptionalLong seed)
        The seed for this sound, used for weighted choices.

        The default seed is the world seed of the receiver's current world.

        Parameters:
        seed - the seed
        Returns:
        this builder
        Since:
        4.12.0