Search in sources :

Example 91 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project Overloaded by CJ-MC-Mods.

the class AbstractMultiArmor method getName.

@Override
@Nonnull
public ITextComponent getName(@Nonnull ItemStack stack) {
    ITextComponent name = super.getName(stack);
    name.getStyle().applyFormat(TextFormatting.GOLD);
    return name;
}
Also used : ITextComponent(net.minecraft.util.text.ITextComponent) Nonnull(javax.annotation.Nonnull)

Example 92 with ITextComponent

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

the class EntityNibiruVillager method getDisplayName.

@Override
public ITextComponent getDisplayName() {
    Team team = this.getTeam();
    String customName = this.getCustomNameTag();
    if (customName != null && !customName.isEmpty()) {
        TextComponentString component = new TextComponentString(ScorePlayerTeam.formatPlayerName(team, customName));
        component.getStyle().setHoverEvent(this.getHoverEvent());
        component.getStyle().setInsertion(this.getCachedUniqueIdString());
        return component;
    } else {
        if (this.buyingList == null) {
            this.populateBuyingList();
        }
        String name = null;
        String type = this.getProfession() > 2 ? "green_vein" : "infected";
        switch(this.getProfession()) {
            case 0:
            case 3:
                name = "farmer";
                break;
            case 1:
            case 4:
                name = "librarian";
                break;
            case 2:
            case 5:
                name = "medic";
                break;
        }
        if (name != null) {
            ITextComponent component = new TextComponentTranslation("entity.nibiru_villager." + type + "_" + name);
            component.getStyle().setHoverEvent(this.getHoverEvent());
            component.getStyle().setInsertion(this.getCachedUniqueIdString());
            if (team != null) {
                component.getStyle().setColor(team.getColor());
            }
            return component;
        } else {
            return super.getDisplayName();
        }
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ITextComponent(net.minecraft.util.text.ITextComponent) ScorePlayerTeam(net.minecraft.scoreboard.ScorePlayerTeam) Team(net.minecraft.scoreboard.Team) TextComponentString(net.minecraft.util.text.TextComponentString) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 93 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project Realistic-Terrain-Generation by Team-RTG.

the class RTGCommandTree method getUsage.

@Override
public String getUsage(ICommandSender sender) {
    final ITextComponent ret = new TextComponentString("");
    getSubCommands().forEach(cmd -> {
        if (cmd instanceof CommandTreeBase) {
            ((CommandTreeBase) cmd).getSubCommands().forEach(rcmd -> ret.appendText("\n").appendText(rcmd.getUsage(sender)));
        } else {
            ret.appendText("\n").appendText(cmd.getUsage(sender));
        }
    });
    return ret.getFormattedText();
}
Also used : ITextComponent(net.minecraft.util.text.ITextComponent) CommandTreeBase(net.minecraftforge.server.command.CommandTreeBase) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 94 with ITextComponent

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

the class JournalDataDrawerIntroduction method drawRightSheet.

@Override
public void drawRightSheet(IntroductionPage page, IPageRenderContext context, MatrixStack transforms, ItemStack stack, IAgriJournalItem journal) {
    float dy = 10;
    float dx = 6;
    float spacing = 4;
    // Title
    dy += context.drawText(transforms, INTRODUCTION, dx, dy);
    dy += spacing;
    // First paragraph
    dy += context.drawText(transforms, PARAGRAPH_1, dx, dy, 0.70F);
    dy += spacing;
    // Second paragraph
    dy += context.drawText(transforms, PARAGRAPH_2, dx, dy, 0.70F);
    dy += spacing;
    // Third paragraph
    dy += context.drawText(transforms, PARAGRAPH_3, dx, dy, 0.70F);
    dy += spacing;
    dy += spacing;
    // Final paragraph:
    ITextComponent discovered = new StringTextComponent("").appendSibling(DISCOVERED).appendString(": " + journal.getDiscoveredSeeds(stack).size() + " / " + AgriApi.getPlantRegistry().count());
    context.drawText(transforms, discovered, dx, dy, 0.70F);
}
Also used : ITextComponent(net.minecraft.util.text.ITextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent)

Example 95 with ITextComponent

use of net.minecraft.util.text.ITextComponent in project RFTools by McJty.

the class CmdListReceivers method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    TeleportDestinations destinations = TeleportDestinations.getDestinations(sender.getEntityWorld());
    Collection<TeleportDestinationClientInfo> validDestinations = destinations.getValidDestinations(sender.getEntityWorld(), null);
    for (TeleportDestinationClientInfo clientInfo : validDestinations) {
        int id = clientInfo.getDimension();
        ITextComponent component = new TextComponentString("    Receiver: dimension=" + id + ", location=" + BlockPosTools.toString(clientInfo.getCoordinate()));
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
    }
}
Also used : TeleportDestinations(mcjty.rftools.blocks.teleporter.TeleportDestinations) TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

ITextComponent (net.minecraft.util.text.ITextComponent)116 TextComponentString (net.minecraft.util.text.TextComponentString)53 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)43 EntityPlayer (net.minecraft.entity.player.EntityPlayer)20 ItemStack (net.minecraft.item.ItemStack)17 Style (net.minecraft.util.text.Style)17 ClickEvent (net.minecraft.util.text.event.ClickEvent)16 HoverEvent (net.minecraft.util.text.event.HoverEvent)9 ArrayList (java.util.ArrayList)8 BlockPos (net.minecraft.util.math.BlockPos)8 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)8 Minecraft (net.minecraft.client.Minecraft)5 StringTextComponent (net.minecraft.util.text.StringTextComponent)4 Text (org.spongepowered.api.text.Text)4 MagicBook (cavern.magic.MagicBook)3 SpecialMagic (cavern.magic.SpecialMagic)3 Matcher (java.util.regex.Matcher)3 TileEntity (net.minecraft.tileentity.TileEntity)3 SoundEvent (net.minecraft.util.SoundEvent)3 TextFormatting (net.minecraft.util.text.TextFormatting)3