Search in sources :

Example 1 with Title

use of net.kyori.adventure.title.Title in project SpongeCommon by SpongePowered.

the class ServerPlayerMixin_API method showTitle.

@Override
public void showTitle(final Title title) {
    if (this.impl$isFake) {
        return;
    }
    final Title.Times times = Objects.requireNonNull(title, "title").times();
    if (times != null) {
        this.connection.send(new ClientboundSetTitlesPacket(this.api$durationToTicks(times.fadeIn()), this.api$durationToTicks(times.stay()), this.api$durationToTicks(times.fadeOut())));
    }
    this.connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.SUBTITLE, SpongeAdventure.asVanilla(title.subtitle())));
    this.connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.TITLE, SpongeAdventure.asVanilla(title.title())));
}
Also used : ClientboundSetTitlesPacket(net.minecraft.network.protocol.game.ClientboundSetTitlesPacket) Title(net.kyori.adventure.title.Title)

Aggregations

Title (net.kyori.adventure.title.Title)1 ClientboundSetTitlesPacket (net.minecraft.network.protocol.game.ClientboundSetTitlesPacket)1