mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 14:30:17 +01:00
add javadocs
This commit is contained in:
parent
f30b10b0a1
commit
1e447e2fc1
3 changed files with 84 additions and 0 deletions
|
@ -1,16 +1,19 @@
|
||||||
package io.papermc.paper.registry;
|
package io.papermc.paper.registry;
|
||||||
|
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
|
import net.kyori.adventure.key.KeyPattern;
|
||||||
import org.jspecify.annotations.NullMarked;
|
import org.jspecify.annotations.NullMarked;
|
||||||
|
|
||||||
@NullMarked
|
@NullMarked
|
||||||
record TypedKeyImpl<T>(Key key, RegistryKey<T> registryKey) implements TypedKey<T> {
|
record TypedKeyImpl<T>(Key key, RegistryKey<T> registryKey) implements TypedKey<T> {
|
||||||
// Wrap key methods to make this easier to use
|
// Wrap key methods to make this easier to use
|
||||||
|
@KeyPattern.Namespace
|
||||||
@Override
|
@Override
|
||||||
public String namespace() {
|
public String namespace() {
|
||||||
return this.key.namespace();
|
return this.key.namespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@KeyPattern.Value
|
||||||
@Override
|
@Override
|
||||||
public String value() {
|
public String value() {
|
||||||
return this.key.value();
|
return this.key.value();
|
||||||
|
|
|
@ -20,12 +20,36 @@ import org.jetbrains.annotations.Range;
|
||||||
@ApiStatus.NonExtendable
|
@ApiStatus.NonExtendable
|
||||||
public interface JukeboxSongRegistryEntry {
|
public interface JukeboxSongRegistryEntry {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sound event for this song.
|
||||||
|
*
|
||||||
|
* @return the sound event
|
||||||
|
*/
|
||||||
|
@Contract(pure = true)
|
||||||
Either<TypedKey<Sound>, SoundEventRegistryEntry> soundEvent();
|
Either<TypedKey<Sound>, SoundEventRegistryEntry> soundEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the description for this song.
|
||||||
|
*
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
@Contract(pure = true)
|
||||||
Component description();
|
Component description();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the length in seconds for this song.
|
||||||
|
*
|
||||||
|
* @return the length in seconds
|
||||||
|
*/
|
||||||
|
@Contract(pure = true)
|
||||||
@Positive float lengthInSeconds();
|
@Positive float lengthInSeconds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the comparator output for this song.
|
||||||
|
*
|
||||||
|
* @return the comparator output
|
||||||
|
*/
|
||||||
|
@Contract(pure = true)
|
||||||
@Range(from = 0, to = 15) int comparatorOutput();
|
@Range(from = 0, to = 15) int comparatorOutput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,18 +69,53 @@ public interface JukeboxSongRegistryEntry {
|
||||||
@ApiStatus.NonExtendable
|
@ApiStatus.NonExtendable
|
||||||
interface Builder extends JukeboxSongRegistryEntry, RegistryBuilder<JukeboxSong> {
|
interface Builder extends JukeboxSongRegistryEntry, RegistryBuilder<JukeboxSong> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the sound event for this song to a sound event present
|
||||||
|
* in the {@link io.papermc.paper.registry.RegistryKey#SOUND_EVENT} registry.
|
||||||
|
* <p>This will override {@link #soundEvent(Consumer)}</p>
|
||||||
|
*
|
||||||
|
* @param soundEvent the sound event
|
||||||
|
* @return this builder
|
||||||
|
* @see #soundEvent(Consumer)
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder soundEvent(TypedKey<Sound> soundEvent);
|
Builder soundEvent(TypedKey<Sound> soundEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the sound event for this song to a new sound event.
|
||||||
|
* <p>This will override {@link #soundEvent(TypedKey)}</p>
|
||||||
|
*
|
||||||
|
* @param soundEvent the sound event
|
||||||
|
* @return this builder
|
||||||
|
* @see #soundEvent(TypedKey)
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder soundEvent(Consumer<? super SoundEventRegistryEntry.Builder> soundEvent);
|
Builder soundEvent(Consumer<? super SoundEventRegistryEntry.Builder> soundEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the description for this song.
|
||||||
|
*
|
||||||
|
* @param description the description
|
||||||
|
* @return this builder
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder description(Component description);
|
Builder description(Component description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the length in seconds for this song.
|
||||||
|
*
|
||||||
|
* @param lengthInSeconds the length in seconds (positive)
|
||||||
|
* @return this builder
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder lengthInSeconds(@Positive float lengthInSeconds);
|
Builder lengthInSeconds(@Positive float lengthInSeconds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the comparator output for this song.
|
||||||
|
*
|
||||||
|
* @param comparatorOutput the comparator output [0-15]
|
||||||
|
* @return this builder
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder comparatorOutput(@Range(from = 0, to = 15) int comparatorOutput);
|
Builder comparatorOutput(@Range(from = 0, to = 15) int comparatorOutput);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,19 @@ import org.jspecify.annotations.Nullable;
|
||||||
@ApiStatus.NonExtendable
|
@ApiStatus.NonExtendable
|
||||||
public interface SoundEventRegistryEntry {
|
public interface SoundEventRegistryEntry {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the resource pack location for this sound event.
|
||||||
|
*
|
||||||
|
* @return the location
|
||||||
|
*/
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
Key location();
|
Key location();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the fixed range for this sound event, if present.
|
||||||
|
*
|
||||||
|
* @return the fixed range, or {@code null} if not present
|
||||||
|
*/
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
@Nullable Float fixedRange();
|
@Nullable Float fixedRange();
|
||||||
|
|
||||||
|
@ -32,9 +42,21 @@ public interface SoundEventRegistryEntry {
|
||||||
@ApiStatus.NonExtendable
|
@ApiStatus.NonExtendable
|
||||||
interface Builder extends SoundEventRegistryEntry, RegistryBuilder<Sound> {
|
interface Builder extends SoundEventRegistryEntry, RegistryBuilder<Sound> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the resource pack location for this sound event.
|
||||||
|
*
|
||||||
|
* @param location the location
|
||||||
|
* @return this builder
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder location(Key location);
|
Builder location(Key location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the fixed range for this sound event.
|
||||||
|
*
|
||||||
|
* @param fixedRange the fixed range
|
||||||
|
* @return this builder
|
||||||
|
*/
|
||||||
@Contract(value = "_ -> this", mutates = "this")
|
@Contract(value = "_ -> this", mutates = "this")
|
||||||
Builder fixedRange(@Nullable Float fixedRange);
|
Builder fixedRange(@Nullable Float fixedRange);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue