Search in sources :

Example 16 with LiteralText

use of net.minecraft.text.LiteralText 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;
        TitleS2CPacket times = new TitleS2CPacket(fadeInTicks, stayTicks, fadeOutTicks);
        player.networkHandler.sendPacket(times);
        if (title != null) {
            TitleS2CPacket titlepkt = new TitleS2CPacket(TitleS2CPacket.Action.TITLE, new LiteralText(title));
            player.networkHandler.sendPacket(titlepkt);
        }
        if (subtitle != null) {
            TitleS2CPacket subtitlepkt = new TitleS2CPacket(TitleS2CPacket.Action.SUBTITLE, new LiteralText(subtitle));
            player.networkHandler.sendPacket(subtitlepkt);
        }
    }
}
Also used : TitleS2CPacket(net.minecraft.network.packet.s2c.play.TitleS2CPacket) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) LiteralText(net.minecraft.text.LiteralText)

Example 17 with LiteralText

use of net.minecraft.text.LiteralText in project dynmap by webbukkit.

the class FabricServer method broadcastMessage.

@Override
public void broadcastMessage(String msg) {
    Text component = new LiteralText(msg);
    server.getPlayerManager().broadcastChatMessage(component, true);
    Log.info(stripChatColor(msg));
}
Also used : LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) LiteralText(net.minecraft.text.LiteralText)

Example 18 with LiteralText

use of net.minecraft.text.LiteralText in project dynmap by webbukkit.

the class FabricPlayer method sendMessage.

@Override
public void sendMessage(String msg) {
    Text ichatcomponent = new LiteralText(msg);
    player.sendMessage(ichatcomponent);
}
Also used : LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) LiteralText(net.minecraft.text.LiteralText)

Example 19 with LiteralText

use of net.minecraft.text.LiteralText in project dynmap by webbukkit.

the class FabricServer method broadcastMessage.

@Override
public void broadcastMessage(String msg) {
    Text component = new LiteralText(msg);
    server.getPlayerManager().broadcastChatMessage(component, true);
    Log.info(stripChatColor(msg));
}
Also used : LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) LiteralText(net.minecraft.text.LiteralText)

Example 20 with LiteralText

use of net.minecraft.text.LiteralText 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)

Aggregations

LiteralText (net.minecraft.text.LiteralText)523 Text (net.minecraft.text.Text)113 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)88 ButtonWidget (net.minecraft.client.gui.widget.ButtonWidget)80 TranslatableText (net.minecraft.text.TranslatableText)68 Screen (net.minecraft.client.gui.screen.Screen)66 ItemStack (net.minecraft.item.ItemStack)62 MatrixStack (net.minecraft.client.util.math.MatrixStack)60 MutableText (net.minecraft.text.MutableText)56 ServerCommandSource (net.minecraft.server.command.ServerCommandSource)54 Inject (org.spongepowered.asm.mixin.injection.Inject)45 ArrayList (java.util.ArrayList)41 Formatting (net.minecraft.util.Formatting)39 List (java.util.List)38 Identifier (net.minecraft.util.Identifier)37 NbtCompound (net.minecraft.nbt.NbtCompound)36 MinecraftClient (net.minecraft.client.MinecraftClient)35 HoverEvent (net.minecraft.text.HoverEvent)35 TextFieldWidget (net.minecraft.client.gui.widget.TextFieldWidget)33 ClickEvent (net.minecraft.text.ClickEvent)33