use of net.minecraft.text.Text in project JexClient by DustinRepo.
the class Messager method actionBar.
public static void actionBar(String message) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
Text text = new LiteralText(message);
minecraftClient.inGameHud.setOverlayMessage(text, false);
}
use of net.minecraft.text.Text in project ViaFabric by ViaVersion.
the class MixinServerEntry method addServerVer.
@Redirect(method = "render", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Ljava/util/List;)V"))
private void addServerVer(MultiplayerScreen multiplayerScreen, List<Text> tooltipText) {
ProtocolVersion proto = ProtocolVersion.getProtocol(((ViaServerInfo) this.server).getViaServerVer());
List<Text> lines = new ArrayList<>(tooltipText);
lines.add(new TranslatableText("gui.ping_version.translated", proto.getName()));
multiplayerScreen.setTooltip(lines);
}
use of net.minecraft.text.Text in project mc-discord-bridge by Selicre.
the class DiscordFormattingConverter method popFormatting.
private void popFormatting(ActiveFormatting entry) {
formattingStack.remove(formattingStack.size() - 1);
activeFormatting.remove(entry.formatting);
LiteralText text = new LiteralText(textBuffer.toString());
textBuffer.setLength(0);
text.setStyle(entry.formatting.getStyle(text));
for (Text child : entry.children) {
text.append(child);
}
addText(text);
}
use of net.minecraft.text.Text in project HWG by cybercat-mods.
the class FlareGunItem method appendTooltip.
@Environment(EnvType.CLIENT)
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
List<ItemStack> list = getProjectiles(stack);
if (isCharged(stack) && !list.isEmpty()) {
ItemStack itemStack = (ItemStack) list.get(0);
tooltip.add((new TranslatableText("Ammo")).append(" ").append(itemStack.toHoverableText()));
if (context.isAdvanced() && itemStack.getItem() == FLARE) {
List<Text> list2 = Lists.newArrayList();
HWGItems.G_EMP.appendTooltip(itemStack, world, list2, context);
if (!list2.isEmpty()) {
for (int i = 0; i < list2.size(); ++i) {
list2.set(i, (new LiteralText(" ")).append((Text) list2.get(i)).formatted(Formatting.GRAY));
}
tooltip.addAll(list2);
}
}
}
tooltip.add(new TranslatableText("hwg.ammo.reloadflares").formatted(Formatting.ITALIC));
}
use of net.minecraft.text.Text in project Client by MatHax.
the class BetterTab method getPlayerName.
public Text getPlayerName(PlayerListEntry playerListEntry) {
Text name;
Color color = null;
name = playerListEntry.getDisplayName();
if (name == null) {
/*if (mc.getSession().getUsername().equals("Matejko06"))
name = new LiteralText(" " + playerListEntry.getProfile().getName());
else*/
name = new LiteralText(playerListEntry.getProfile().getName());
}
if (playerListEntry.getProfile().getId().toString().equals(mc.player.getGameProfile().getId().toString()) && self.get()) {
color = selfColor.get();
} else if (friends.get() && Friends.get().get(playerListEntry.getProfile().getName()) != null) {
Friend friend = Friends.get().get(playerListEntry.getProfile().getName());
if (friend != null)
color = Friends.get().color;
} else if (enemies.get() && Enemies.get().get(playerListEntry.getProfile().getName()) != null) {
Enemy enemy = Enemies.get().get(playerListEntry.getProfile().getName());
if (enemy != null)
color = Enemies.get().color;
}
if (color != null) {
String nameString = name.getString();
for (Formatting format : Formatting.values()) {
if (format.isColor())
nameString = nameString.replace(format.toString(), "");
}
name = new LiteralText(nameString).setStyle(name.getStyle().withColor(new TextColor(color.getPacked())));
}
return name;
}
Aggregations