Search in sources :

Example 41 with Style

use of net.minecraft.util.text.Style in project GregTech by GregTechCE.

the class ImplosionCompressorInfo method generateBlockTooltips.

@Override
protected void generateBlockTooltips() {
    super.generateBlockTooltips();
    ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit", 14).setStyle(new Style().setColor(TextFormatting.AQUA));
    addBlockTooltip(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID), tooltip);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ITextComponent(net.minecraft.util.text.ITextComponent) Style(net.minecraft.util.text.Style)

Example 42 with Style

use of net.minecraft.util.text.Style in project ICBM-Classic by BuiltBrokenModding.

the class ItemRocketLauncher method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag flag) {
    final String key = "item.icbmclassic:rocketLauncher.info";
    String translation = LanguageUtility.getLocal(key);
    if (translation.contains("%s")) {
        String str = String.format(translation, String.valueOf(ConfigMain.ROCKET_LAUNCHER_TIER_FIRE_LIMIT));
        splitAdd(str, list, false, false);
    }
    if (Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.isCreative())
        list.add(new TextComponentTranslation("item.icbmclassic:rocketLauncher.info.creative").setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE)).getFormattedText());
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) Style(net.minecraft.util.text.Style) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 43 with Style

use of net.minecraft.util.text.Style in project malmo by Microsoft.

the class AgentQuitFromTimeUpImplementation method drawCountDown.

@Override
protected void drawCountDown(int secondsRemaining) {
    TextComponentString text = new TextComponentString("" + secondsRemaining + "...");
    Style style = new Style();
    style.setBold(true);
    if (secondsRemaining <= 5)
        style.setColor(TextFormatting.RED);
    text.setStyle(style);
    Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(text, 1);
}
Also used : Style(net.minecraft.util.text.Style) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 44 with Style

use of net.minecraft.util.text.Style in project MorePlanets by SteveKunG.

the class CommandOpenCelestialScreen method execute.

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    EntityPlayerMP player = PlayerUtil.getPlayerBaseServerFromPlayerUsername(sender.getName(), true);
    if (args.length == 1 && args[0].equals("disable")) {
        if (!WorldTickEventHandler.survivalPlanetData.disableMessage) {
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMP(EnumSimplePacketMP.S_SAVE_DISABLE_MESSAGE, GCCoreUtil.getDimensionID(player.world)));
            sender.sendMessage(new TextComponentString(ColorUtils.stringToRGB(IItemRarity.ALIEN).toColoredFont() + "[More Planets] ").appendSibling(new TextComponentTranslation("command.mpcelestial.1").setStyle(new Style().setColor(TextFormatting.YELLOW))));
        }
    } else {
        if (!WorldTickEventHandler.survivalPlanetData.hasSurvivalPlanetData) {
            GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMP(EnumSimplePacketMP.C_OPEN_SURVIVAL_PLANET_GUI, player.dimension), player);
        } else {
            sender.sendMessage(new TextComponentString(ColorUtils.stringToRGB(IItemRarity.ALIEN).toColoredFont() + "[More Planets] ").appendSibling(new TextComponentTranslation("command.mpcelestial.2").setStyle(new Style().setColor(TextFormatting.RED))));
        }
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) Style(net.minecraft.util.text.Style) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) PacketSimpleMP(stevekung.mods.moreplanets.network.PacketSimpleMP) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 45 with Style

use of net.minecraft.util.text.Style in project AgriCraft by AgriCraft.

the class AgriGenomeRenderer method renderTextOverlay.

public void renderTextOverlay(MatrixStack transforms, IAgriGenePair<?> genePair) {
    // Fetch font renderer
    FontRenderer fontRenderer = this.getFontRenderer();
    // Fetch styles
    Tuple<Style, Style> textFormats = this.getTextFormats(genePair.getGene());
    // Fetch colors
    int blackColor = STYLE_GENE.getColor() == null ? 0 : STYLE_GENE.getColor().getColor();
    int domColor = textFormats.getA().getColor() == null ? 0 : textFormats.getA().getColor().getColor();
    int recColor = textFormats.getB().getColor() == null ? 0 : textFormats.getB().getColor().getColor();
    // Fetch text components
    IReorderingProcessor geneText = genePair.getGene().getGeneDescription().mergeStyle(STYLE_GENE).func_241878_f();
    IReorderingProcessor domText = genePair.getDominant().getTooltip().func_241878_f();
    IReorderingProcessor recText = genePair.getRecessive().getTooltip().func_241878_f();
    // Calculate positions
    float y1 = 0;
    float x1 = (-fontRenderer.func_243245_a(geneText) + 0.0F) / 2;
    float y2 = y1 + 1.5F * fontRenderer.FONT_HEIGHT;
    float x2 = (-fontRenderer.func_243245_a(TEXT_SEPARATOR) + 0.0F) / 2;
    float delta = 1.0F;
    float dx_d = delta + fontRenderer.func_243245_a(domText);
    float dx_r = delta + fontRenderer.func_243245_a(TEXT_SEPARATOR);
    // Render text
    this.getFontRenderer().func_238422_b_(transforms, geneText, x1, y1, blackColor);
    this.getFontRenderer().func_238422_b_(transforms, TEXT_SEPARATOR, x2, y2, blackColor);
    this.getFontRenderer().func_238422_b_(transforms, domText, x2 - dx_d, y2, blackColor);
    this.getFontRenderer().func_238422_b_(transforms, recText, x2 + dx_r, y2, blackColor);
}
Also used : IReorderingProcessor(net.minecraft.util.IReorderingProcessor) Style(net.minecraft.util.text.Style) FontRenderer(net.minecraft.client.gui.FontRenderer)

Aggregations

Style (net.minecraft.util.text.Style)51 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)30 TextComponentString (net.minecraft.util.text.TextComponentString)21 ITextComponent (net.minecraft.util.text.ITextComponent)17 ClickEvent (net.minecraft.util.text.event.ClickEvent)10 BlockPos (net.minecraft.util.math.BlockPos)9 CommandException (net.minecraft.command.CommandException)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ItemStack (net.minecraft.item.ItemStack)4 World (net.minecraft.world.World)4 Colony (com.minecolonies.coremod.colony.Colony)3 PlayerIdentifier (com.mraof.minestuck.util.IdentifierHandler.PlayerIdentifier)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 GameProfile (com.mojang.authlib.GameProfile)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 HoverEvent (net.minecraft.util.text.event.HoverEvent)2 Biome (net.minecraft.world.biome.Biome)2 FluidStack (net.minecraftforge.fluids.FluidStack)2