Search in sources :

Example 11 with Text

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

the class FabricCommandSender method sendMessage.

@Override
public void sendMessage(String msg) {
    if (sender != null) {
        Text ichatcomponent = new LiteralText(msg);
        sender.sendFeedback(ichatcomponent, false);
    }
}
Also used : LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) LiteralText(net.minecraft.text.LiteralText)

Example 12 with Text

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

the class FabricCommandSender method sendMessage.

@Override
public void sendMessage(String msg) {
    if (sender != null) {
        Text ichatcomponent = new LiteralText(msg);
        sender.sendFeedback(ichatcomponent, false);
    }
}
Also used : LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) LiteralText(net.minecraft.text.LiteralText)

Example 13 with Text

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

the class FabricServer method broadcastMessage.

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

Example 14 with Text

use of net.minecraft.text.Text in project MiniMap by pl3xgaming.

the class AboutCategory method renderContent.

@Override
public void renderContent(MatrixStack matrixStack, float mouseX, float mouseY, float delta) {
    float x = (Monitor.width() + baseX()) / 2F;
    float y = baseY() + 80F;
    Texture.ICON.tint(matrixStack, x - 32 + 4F, y + 4F, 64, 64, 0x88000000);
    Texture.ICON.draw(matrixStack, x - 32, y, 64, 64);
    Font.GOODDOG.drawCentered(matrixStack, Lang.TITLE, x + 3F, y + 85F + 3F, 0x88000000);
    Font.GOODDOG.drawCentered(matrixStack, Lang.TITLE, x, y + 85F, 0xFFFFFFFF);
    Font.NOTOSANS.drawCentered(matrixStack, "Copyright (c) 2020-2022", x + 1F, y + 140 + 1F, 0x88000000);
    Font.NOTOSANS.drawCentered(matrixStack, "Copyright (c) 2020-2022", x, y + 140, 0xFFFFFFFF);
    Font.NOTOSANS.drawCentered(matrixStack, "William Blake Galbreath", x + 1F, y + 160 + 1F, 0x88000000);
    Font.NOTOSANS.drawCentered(matrixStack, "William Blake Galbreath", x, y + 160, 0xFFFFFFFF);
    String mc = UpdateChecker.INSTANCE.getMinecraftVersion();
    int current = UpdateChecker.INSTANCE.getCurrentVersion();
    int latest = UpdateChecker.INSTANCE.getLatestVersion();
    // todo cache this component somewhere
    Text currentVersion = new TranslatableText("Current Version: " + mc + (current < 0 ? " SNAPSHOT" : " build " + current));
    Font.NOTOSANS.drawCentered(matrixStack, currentVersion, x + 1F, y + 230 + 1F, 0x88000000);
    Font.NOTOSANS.drawCentered(matrixStack, currentVersion, x, y + 230, 0xFFFFFFFF);
    // todo cache this component somewhere
    Text text;
    if (latest > 0) {
        text = new TranslatableText("Latest Version: " + mc + " build " + latest);
    } else if (latest == UpdateChecker.Status.CHECKING) {
        text = new TranslatableText("Checking for updates...").formatted(Formatting.LIGHT_PURPLE);
    } else if (latest == UpdateChecker.Status.ERROR) {
        text = new TranslatableText("Error checking for updates!").formatted(Formatting.RED);
    } else if (latest == current) {
        text = new TranslatableText("Up to date!").formatted(Formatting.GREEN);
    } else {
        text = new TranslatableText("Unknown").formatted(Formatting.GOLD);
    }
    Font.NOTOSANS.drawCentered(matrixStack, text.copy().formatted(Formatting.RESET), x + 1F, y + 260 + 1F, 0x88000000);
    Font.NOTOSANS.drawCentered(matrixStack, text, x, y + 260, 0xFFFFFFFF);
    if (UpdateChecker.INSTANCE.hasUpdate()) {
        Font.ROBOTO.drawCentered(matrixStack, "Updates Available!", x + 1F, y + 280 + 1F, 0x88880000);
        Font.ROBOTO.drawCentered(matrixStack, "Updates Available!", x, y + 280, 0xFFFF5555);
    }
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) TranslatableText(net.minecraft.text.TranslatableText) Text(net.minecraft.text.Text)

Example 15 with Text

use of net.minecraft.text.Text in project BleachHack by BleachDrinker420.

the class Texts method unpack.

/**
 * Unpacks a text and all its nested siblings into a list of texts. *
 */
public static List<Text> unpack(Text text) {
    Stack<MutablePair<Text, Integer>> nodes = new Stack<>();
    List<Text> texts = new ArrayList<>();
    nodes.push(MutablePair.of(text, 0));
    texts.add(copy(text, true, false));
    while (!nodes.isEmpty()) {
        MutablePair<Text, Integer> pair = nodes.peek();
        if (pair.getLeft().getSiblings().size() > pair.getRight()) {
            Text sibling = pair.getLeft().getSiblings().get(pair.getRight());
            nodes.push(MutablePair.of(sibling, 0));
            texts.add(copy(sibling, true, false));
            pair.setRight(pair.getRight() + 1);
        } else {
            nodes.pop();
        }
    }
    return texts;
}
Also used : MutablePair(org.apache.commons.lang3.tuple.MutablePair) ArrayList(java.util.ArrayList) LiteralText(net.minecraft.text.LiteralText) BaseText(net.minecraft.text.BaseText) MutableText(net.minecraft.text.MutableText) Text(net.minecraft.text.Text) Stack(java.util.Stack)

Aggregations

Text (net.minecraft.text.Text)80 LiteralText (net.minecraft.text.LiteralText)53 TranslatableText (net.minecraft.text.TranslatableText)19 MutableText (net.minecraft.text.MutableText)9 ItemStack (net.minecraft.item.ItemStack)8 MinecraftClient (net.minecraft.client.MinecraftClient)7 Formatting (net.minecraft.util.Formatting)7 ArrayList (java.util.ArrayList)6 HoverEvent (net.minecraft.text.HoverEvent)5 TextColor (net.minecraft.text.TextColor)5 Inject (org.spongepowered.asm.mixin.injection.Inject)5 List (java.util.List)4 ServerCommandSource (net.minecraft.server.command.ServerCommandSource)4 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)4 BaseText (net.minecraft.text.BaseText)4 CommandDispatcher (com.mojang.brigadier.CommandDispatcher)3 UUID (java.util.UUID)3 Matcher (java.util.regex.Matcher)3 NbtCompound (net.minecraft.nbt.NbtCompound)3 OrderedText (net.minecraft.text.OrderedText)3