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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ServerPacket
createEntitySoundPacket
(@NotNull Sound sound, @NotNull Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.static @NotNull ServerPacket
createSoundPacket
(@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 ServerPacket
createSoundPacket
(@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 ServerPacket
createSoundStopPacket
(@NotNull SoundStop stop) Creates a sound stop packet from a sound stop.static <T> @NotNull ServerPacket
createTitlePartPacket
(@NotNull TitlePart<T> part, T value) Creates one of the three title packets from a title part and a value.static int
Gets the int value of a boss bar color.static byte
getBossBarFlagValue
(@NotNull Collection<BossBar.Flag> flags) Gets the byte value of a collection of boss bar flags.static int
getBossBarOverlayValue
(BossBar.Overlay overlay) Gets the int value of a boss bar overlay.static int
getNamedTextColorValue
(@NotNull NamedTextColor color) Gets the int value from a named text color.static int
getSoundSourceValue
(Sound.Source source) Gets the int value of a sound source.
-
Constructor Details
-
AdventurePacketConvertor
public AdventurePacketConvertor()
-
-
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
-
createEntitySoundPacket
@Deprecated(forRemoval=true) public static ServerPacket createEntitySoundPacket(@NotNull @NotNull Sound sound, @NotNull @NotNull Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.Creates an entity sound packet from an Adventure sound.- Parameters:
sound
- the soundentity
- the entity the sound is coming from- Returns:
- the 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
-
createSoundPacket(Sound, Sound.Emitter)