Search in sources :

Example 1 with TitleFadeS2CPacket

use of net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket in project HadesGameV2 by CaaMoe.

the class GameCore method sendTitle.

// 发送标题
public void sendTitle(ServerPlayerEntity playerEntity, Text title, Text subtitle, int fadeIn, int fadeOut, int delay) {
    TitleFadeS2CPacket time = new TitleFadeS2CPacket(fadeIn, delay, fadeOut);
    TitleS2CPacket titlePacket = new TitleS2CPacket(title);
    SubtitleS2CPacket subtitlePacket = new SubtitleS2CPacket(subtitle);
    playerEntity.networkHandler.sendPacket(time);
    playerEntity.networkHandler.sendPacket(titlePacket);
    playerEntity.networkHandler.sendPacket(subtitlePacket);
}
Also used : TitleFadeS2CPacket(net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket) SubtitleS2CPacket(net.minecraft.network.packet.s2c.play.SubtitleS2CPacket) TitleS2CPacket(net.minecraft.network.packet.s2c.play.TitleS2CPacket)

Example 2 with TitleFadeS2CPacket

use of net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket in project dynmap by webbukkit.

the class FabricPlayer method sendTitleText.

/**
 * Send title and subtitle text (called from server thread)
 */
@Override
public void sendTitleText(String title, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
    if (player != null) {
        ServerPlayerEntity player = this.player;
        TitleFadeS2CPacket times = new TitleFadeS2CPacket(fadeInTicks, stayTicks, fadeOutTicks);
        player.networkHandler.sendPacket(times);
        if (title != null) {
            TitleS2CPacket titlepkt = new TitleS2CPacket(new LiteralText(title));
            player.networkHandler.sendPacket(titlepkt);
        }
        if (subtitle != null) {
            SubtitleS2CPacket subtitlepkt = new SubtitleS2CPacket(new LiteralText(subtitle));
            player.networkHandler.sendPacket(subtitlepkt);
        }
    }
}
Also used : TitleFadeS2CPacket(net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket) SubtitleS2CPacket(net.minecraft.network.packet.s2c.play.SubtitleS2CPacket) TitleS2CPacket(net.minecraft.network.packet.s2c.play.TitleS2CPacket) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) LiteralText(net.minecraft.text.LiteralText)

Example 3 with TitleFadeS2CPacket

use of net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket in project dynmap by webbukkit.

the class FabricPlayer method sendTitleText.

/**
 * Send title and subtitle text (called from server thread)
 */
@Override
public void sendTitleText(String title, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
    if (player != null) {
        ServerPlayerEntity player = this.player;
        TitleFadeS2CPacket times = new TitleFadeS2CPacket(fadeInTicks, stayTicks, fadeOutTicks);
        player.networkHandler.sendPacket(times);
        if (title != null) {
            TitleS2CPacket titlepkt = new TitleS2CPacket(new LiteralText(title));
            player.networkHandler.sendPacket(titlepkt);
        }
        if (subtitle != null) {
            SubtitleS2CPacket subtitlepkt = new SubtitleS2CPacket(new LiteralText(subtitle));
            player.networkHandler.sendPacket(subtitlepkt);
        }
    }
}
Also used : TitleFadeS2CPacket(net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket) SubtitleS2CPacket(net.minecraft.network.packet.s2c.play.SubtitleS2CPacket) TitleS2CPacket(net.minecraft.network.packet.s2c.play.TitleS2CPacket) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) LiteralText(net.minecraft.text.LiteralText)

Example 4 with TitleFadeS2CPacket

use of net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket in project dynmap by webbukkit.

the class FabricPlayer method sendTitleText.

/**
 * Send title and subtitle text (called from server thread)
 */
@Override
public void sendTitleText(String title, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
    if (player != null) {
        ServerPlayerEntity player = this.player;
        TitleFadeS2CPacket times = new TitleFadeS2CPacket(fadeInTicks, stayTicks, fadeOutTicks);
        player.networkHandler.sendPacket(times);
        if (title != null) {
            TitleS2CPacket titlepkt = new TitleS2CPacket(new LiteralText(title));
            player.networkHandler.sendPacket(titlepkt);
        }
        if (subtitle != null) {
            SubtitleS2CPacket subtitlepkt = new SubtitleS2CPacket(new LiteralText(subtitle));
            player.networkHandler.sendPacket(subtitlepkt);
        }
    }
}
Also used : TitleFadeS2CPacket(net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket) SubtitleS2CPacket(net.minecraft.network.packet.s2c.play.SubtitleS2CPacket) TitleS2CPacket(net.minecraft.network.packet.s2c.play.TitleS2CPacket) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) LiteralText(net.minecraft.text.LiteralText)

Example 5 with TitleFadeS2CPacket

use of net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket in project dynmap by webbukkit.

the class FabricPlayer method sendTitleText.

/**
 * Send title and subtitle text (called from server thread)
 */
@Override
public void sendTitleText(String title, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
    if (player != null) {
        ServerPlayerEntity player = this.player;
        TitleFadeS2CPacket times = new TitleFadeS2CPacket(fadeInTicks, stayTicks, fadeOutTicks);
        player.networkHandler.sendPacket(times);
        if (title != null) {
            TitleS2CPacket titlepkt = new TitleS2CPacket(Text.literal(title));
            player.networkHandler.sendPacket(titlepkt);
        }
        if (subtitle != null) {
            SubtitleS2CPacket subtitlepkt = new SubtitleS2CPacket(Text.literal(subtitle));
            player.networkHandler.sendPacket(subtitlepkt);
        }
    }
}
Also used : TitleFadeS2CPacket(net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket) SubtitleS2CPacket(net.minecraft.network.packet.s2c.play.SubtitleS2CPacket) TitleS2CPacket(net.minecraft.network.packet.s2c.play.TitleS2CPacket) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity)

Aggregations

SubtitleS2CPacket (net.minecraft.network.packet.s2c.play.SubtitleS2CPacket)5 TitleFadeS2CPacket (net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket)5 TitleS2CPacket (net.minecraft.network.packet.s2c.play.TitleS2CPacket)5 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)4 LiteralText (net.minecraft.text.LiteralText)3