Package net.minestom.server.adventure
Class AdventurePacketConvertor
java.lang.Object
net.minestom.server.adventure.AdventurePacketConvertor
Utility methods to convert adventure enums to their packet values.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ServerPacketcreateSoundPacket(@NotNull Sound sound, double x, double y, double z) Creates a sound packet from a sound and a location.
Random variation by default unless a seed is provided in theSound.static @NotNull ServerPacketcreateSoundPacket(@NotNull Sound sound, @NotNull Sound.Emitter emitter) Creates a sound effect packet from a sound and an emitter.
Random variation by default unless a seed is provided in theSound.static ServerPacketcreateSoundStopPacket(@NotNull SoundStop stop) Creates a sound stop packet from a sound stop.static <T> @NotNull ServerPacketcreateTitlePartPacket(@NotNull TitlePart<T> part, T value) Creates one of the three title packets from a title part and a value.static intGets the int value of a boss bar color.static bytegetBossBarFlagValue(@NotNull Collection<BossBar.Flag> flags) Gets the byte value of a collection of boss bar flags.static intgetBossBarOverlayValue(BossBar.Overlay overlay) Gets the int value of a boss bar overlay.static intgetNamedTextColorValue(@NotNull NamedTextColor color) Gets the int value from a named text color.static intgetSoundSourceValue(Sound.Source source) Gets the int value of a sound source.
-
Method Details
-
getBossBarOverlayValue
Gets the int value of a boss bar overlay.- Parameters:
overlay- the overlay- Returns:
- the value
-
getBossBarFlagValue
Gets the byte value of a collection of boss bar flags.- Parameters:
flags- the flags- Returns:
- the value
-
getBossBarColorValue
Gets the int value of a boss bar color.- Parameters:
color- the color- Returns:
- the value
-
getSoundSourceValue
Gets the int value of a sound source.- Parameters:
source- the source- Returns:
- the value
-
getNamedTextColorValue
Gets the int value from a named text color.- Parameters:
color- the color- Returns:
- the int value
-
createSoundPacket
@NotNull public static @NotNull ServerPacket createSoundPacket(@NotNull @NotNull Sound sound, double x, double y, double z) Creates a sound packet from a sound and a location.
Random variation by default unless a seed is provided in theSound.- Parameters:
sound- the soundx- the x coordinatey- the y coordinatez- the z coordinate- Returns:
- the sound packet
-
createSoundPacket
@NotNull public static @NotNull ServerPacket createSoundPacket(@NotNull @NotNull Sound sound, @NotNull Sound.Emitter emitter) Creates a sound effect packet from a sound and an emitter.
Random variation by default unless a seed is provided in theSound.- Parameters:
sound- the soundemitter- the emitter, must be anEntity- Returns:
- the sound packet
-
createSoundStopPacket
Creates a sound stop packet from a sound stop.- Parameters:
stop- the sound stop- Returns:
- the sound stop packet
-
createTitlePartPacket
@NotNull public static <T> @NotNull ServerPacket createTitlePartPacket(@NotNull @NotNull TitlePart<T> part, @NotNull T value) Creates one of the three title packets from a title part and a value.- Type Parameters:
T- the type of the part- Parameters:
part- the partvalue- the value- Returns:
- the title packet
-