Java 类net.minecraft.util.text.TextFormatting 实例源码

项目:Loot-Slash-Conquer    文件:ItemLEMagical.java   
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
    Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);
    PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);

    if (statsCap != null && playerInfo != null)
    {
        if (statsCap.getMana() - this.manaPerUse >= 0 && playerInfo.getPlayerLevel() >= NBTHelper.loadStackNBT(player.inventory.getCurrentItem()).getInteger("Level"))
        {   
            player.setActiveHand(hand);
            return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.inventory.getCurrentItem());
        }
    }

    if (playerInfo.getPlayerLevel() < NBTHelper.loadStackNBT(player.inventory.getCurrentItem()).getInteger("Level"))
    {
        player.sendMessage(new TextComponentString(TextFormatting.RED + "WARNING: You are using a high-leveled item. It will be useless and will take significantly more damage if it is not removed."));
    }

    return new ActionResult<ItemStack>(EnumActionResult.FAIL, player.inventory.getCurrentItem());
}
项目:Backmemed    文件:EntitySelector.java   
private static <T extends Entity> boolean isEntityTypeValid(ICommandSender commandSender, Map<String, String> params)
{
    String s = getArgument(params, field_190849_w);

    if (s == null)
    {
        return true;
    }
    else
    {
        ResourceLocation resourcelocation = new ResourceLocation(s.startsWith("!") ? s.substring(1) : s);

        if (EntityList.isStringValidEntityName(resourcelocation))
        {
            return true;
        }
        else
        {
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.entity.invalidType", new Object[] {resourcelocation});
            textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
            commandSender.addChatMessage(textcomponenttranslation);
            return false;
        }
    }
}
项目:ProgressiveDifficulty    文件:EventHandler.java   
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event){
    if(DifficultyManager.enabled && ProgressiveDifficulty.oldConfigExists){
        TextComponentString linkComponent = new TextComponentString("[Progressive Difficulty Wiki]");
        ITextComponent[] chats = new ITextComponent[]{
                new TextComponentString("[ProgressiveDifficulty] It looks like you have a version 1.0 " +
                        "config file. Please check out the Progressive Difficulty Wiki for instructions on how" +
                        " to migrate to a version 2.0 config file."),
                linkComponent
        };
        ClickEvent goLinkEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,"https://github.com/talandar/ProgressiveDifficulty/wiki/2.0-Transition");
        linkComponent.getStyle().setClickEvent(goLinkEvent);
        linkComponent.getStyle().setColor(TextFormatting.BLUE);
        linkComponent.getStyle().setUnderlined(true);
        ChatUtil.sendChat(event.player,chats);
    }
}
项目:MobBlocker    文件:BlockChunkProtector.java   
/**
 * Called by TOP compatibility handler
 * @param mode
 * @param probeInfo
 * @param player
 * @param world
 * @param blockState
 * @param data
 */
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
    TileEntity te = world.getTileEntity(data.getPos());
    if (te instanceof TileEntityChunkProtector) {
        TileEntityChunkProtector chunkprotector = (TileEntityChunkProtector) te;
        int secondsLeft = chunkprotector.getSecondsBeforeDestroyed();
        int ticksLeft = chunkprotector.getTicksBeforeDestroyed();
        if (ticksLeft != -1) {
            if (mode == ProbeMode.NORMAL) {
                probeInfo.text(TextFormatting.BLUE + Integer.toString(secondsLeft) + " seconds left in world");
            } else if (mode == ProbeMode.EXTENDED) {
                probeInfo.text(TextFormatting.BLUE + Integer.toString(ticksLeft) + " ticks left in world");
            } else if (mode == ProbeMode.DEBUG) {
                probeInfo.text(TextFormatting.BLUE + Integer.toString(secondsLeft) + " seconds left in world");
                probeInfo.text(TextFormatting.BLUE + Integer.toString(ticksLeft) + " ticks left in world");
            }
        } else probeInfo.text(TextFormatting.GRAY + "Won't decay");
    }
}
项目:LagGoggles    文件:TeleportRequestHandler.java   
@Override
public IMessage onMessage(TeleportRequest message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().player;
    if(Perms.isOP(player) == false){
        Main.LOGGER.info(player.getName() + " tried to teleport, but was denied to do so!");
        return null;
    }
    new RunInServerThread(new Runnable() {
        @Override
        public void run() {
            Entity e = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityFromUuid(message.uuid);
            if(e == null){
                player.sendMessage(new TextComponentString(TextFormatting.RED + "Woops! This tile entity no longer exists!"));
                return;
            }
            Teleport.teleportPlayer(player, e.dimension, e.posX, e.posY, e.posZ);
        }
    });
    return null;
}
项目:Never-Enough-Currency    文件:ItemWallet.java   
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
    tooltip.add("Extra storage for your money!");

    if (stack.hasTagCompound()) {
        InventoryItem inventory = new InventoryItem(stack);

        float value = 0;
        for (int i = 0; i < inventory.getSizeInventory(); i++) {
            if (inventory.getStackInSlot(i) != ItemStack.EMPTY && inventory.getStackInSlot(i).getItem() instanceof ItemMoneyBase) {
                value += ((ItemMoneyBase) inventory.getStackInSlot(i).getItem()).getValue() * inventory.getStackInSlot(i).getCount();
            }
        }

        tooltip.add("Currently storing: " + NumberFormat.getCurrencyInstance(Locale.US).format(value));
    }

    tooltip.add(TextFormatting.BLUE + "Only holds currency.");
}
项目:Industrial-Foregoing    文件:PetrifiedFuelInfoPiece.java   
@Override
public void drawForegroundLayer(BasicTeslaGuiContainer container, int guiX, int guiY, int mouseX, int mouseY) {
    super.drawForegroundLayer(container, guiX, guiY, mouseX, mouseY);
    if (this.tile != null) {
        long timeLeft = 0;
        long generatingRate = 0;
        if (this.tile.getGeneratedPowerStored() > 0) {
            timeLeft = ((this.tile.getGeneratedPowerStored() / 2) / this.tile.getGeneratedPowerReleaseRate()) / 20;
            generatingRate = this.tile.getGeneratedPowerReleaseRate();
        }
        FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
        GlStateManager.pushMatrix();
        GlStateManager.translate(this.getLeft() + 2, this.getTop() + 2, 0);
        GlStateManager.scale(1, 1, 1);
        renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.burning").getFormattedText(), 4, 4, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + getFormatedTime(timeLeft * 1000), 8, (renderer.FONT_HEIGHT) + 5, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.producing").getFormattedText(), 4, 2 * (renderer.FONT_HEIGHT) + 9, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + "" + generatingRate + " RF/tick", 8, 3 * (renderer.FONT_HEIGHT) + 10, 0xFFFFFF);
        GlStateManager.popMatrix();
    }
}
项目:pnc-repressurized    文件:WailaRedstoneControl.java   
public static void addTipToMachine(List<String> currenttip, IWailaDataAccessor accessor) {
    NBTTagCompound tag = accessor.getNBTData();
    //This is used so that we can split values later easier and have them all in the same layout.
    Map<String, String> values = new HashMap<>();

    if (tag.hasKey("redstoneMode")) {
        int mode = tag.getInteger("redstoneMode");
        GuiPneumaticContainerBase gui = (GuiPneumaticContainerBase) PneumaticCraftRepressurized.proxy.getClientGuiElement(((BlockPneumaticCraft) accessor.getBlock()).getGuiID().ordinal(),
                accessor.getPlayer(), accessor.getWorld(), accessor.getPosition().getX(), accessor.getPosition().getY(), accessor.getPosition().getZ());
        TileEntity te = accessor.getTileEntity();
        if (te instanceof TileEntityBase) {
            values.put(((TileEntityBase) te).getRedstoneString(), ((TileEntityBase) te).getRedstoneButtonText(mode));
        }
    }

    //Get all the values from the map and put them in the list.
    for (Map.Entry<String, String> entry : values.entrySet()) {
        currenttip.add(TextFormatting.RED + I18n.format(entry.getKey()) + ": " + I18n.format(entry.getValue()));
    }
}
项目:pnc-repressurized    文件:ItemManometer.java   
@Override
public boolean itemInteractionForEntity(ItemStack iStack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) {
    if (!player.world.isRemote) {
        if (entity instanceof IManoMeasurable) {
            if (((IPressurizable) iStack.getItem()).getPressure(iStack) > 0F) {
                List<String> curInfo = new ArrayList<String>();
                ((IManoMeasurable) entity).printManometerMessage(player, curInfo);
                if (curInfo.size() > 0) {
                    ((IPressurizable) iStack.getItem()).addAir(iStack, -30);
                    for (String s : curInfo) {
                        player.sendStatusMessage(new TextComponentTranslation(s), false);
                    }
                    return true;
                }
            } else {
                player.sendStatusMessage(new TextComponentTranslation(TextFormatting.RED + "The Manometer doesn't have any charge!"), false);
            }
        }
    }
    return false;
}
项目:pnc-repressurized    文件:TileEntitySecurityStation.java   
@Override
public void handleGUIButtonPress(int buttonID, EntityPlayer player) {
    if (buttonID == 0) {
        redstoneMode++;
        if (redstoneMode > 2) redstoneMode = 0;
        updateNeighbours();
    } else if (buttonID == 2) {
        rebootStation();
    } else if (buttonID == 3) {
        if (!hasValidNetwork()) {
            player.sendStatusMessage(new TextComponentTranslation(TextFormatting.GREEN + "This Security Station is out of order: Its network hasn't been properly configured."), false);
        } else {
            player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.HACKING.ordinal(), getWorld(), getPos().getX(), getPos().getY(), getPos().getZ());
        }
    } else if (buttonID > 3 && buttonID - 4 < sharedUsers.size()) {
        sharedUsers.remove(buttonID - 4);
    }
    sendDescriptionPacket();
}
项目:Defier    文件:PatternItem.java   
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
     if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("defieritem")){
         tooltip.add("Blank Pattern");
     }else{
         ItemStack stored = new ItemStack(stack.getTagCompound().getCompoundTag("defieritem"));
         DefierRecipe recipe = DefierRecipeRegistry.findRecipeForStack(stored);
         if(recipe == null){
             tooltip.add(TextFormatting.RED + "Unknown Recipe");
         }else{
             stored.clearCustomName();
             tooltip.add("Item: " + stored.getDisplayName());
             tooltip.add("Energy Cost: " + Defier.LARGE_NUMBER.format(recipe.getCost()) + "RF");
         }
     }
}
项目:PurificatiMagicae    文件:ItemPapyrus.java   
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
{
    if (stack.hasTagCompound())
    {
        if (stack.getTagCompound().hasKey("papyrus_id"))
        {
            PapyrusData dat = PurMag.INSTANCE.getPapyrusRegistry().getPapyrus(stack.getTagCompound().getString("papyrus_id"));
            if (dat != null)
                tooltip.add(TextFormatting.GOLD + dat.getDisplayName() + TextFormatting.RESET);
        }
    }
}
项目:MeeCreeps    文件:CreepCubeItem.java   
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
    Collections.addAll(tooltip, StringUtils.split(I18n.format("message.meecreeps.tooltip.cube_intro"), "\n"));

    MeeCreepActionType lastAction = getLastAction(stack);
    if (lastAction != null) {
        MeeCreepsApi.Factory factory = MeeCreeps.api.getFactory(lastAction);
        tooltip.add(TextFormatting.YELLOW + "    (" + I18n.format(factory.getMessage()) + ")");
    }
    if (isLimited()) {
        Collections.addAll(tooltip, StringUtils.split(I18n.format("message.meecreeps.tooltip.cube_uses", Integer.toString(Config.meeCreepBoxMaxUsage - getUsages(stack))), "\n"));
    }
}
项目:Loot-Slash-Conquer    文件:EventItemTooltip.java   
private void drawBauble(ArrayList<String> tooltip, ItemStack stack, NBTTagCompound nbt, EntityPlayer player, PlayerInformation info)
{
    /*
     * NAME
     * Level
     * 
     * Attributes
     */

    // Level
    if (info.getPlayerLevel() < nbt.getInteger("Level")) tooltip.add(1, TextFormatting.RED + "Level: " + nbt.getInteger("Level"));
    else tooltip.add(1, "Level: " + nbt.getInteger("Level"));

    tooltip.add("");

    // Attributes
    DecimalFormat format = new DecimalFormat("#.##");
    tooltip.add(TextFormatting.ITALIC + "Attributes");

    for (JewelryAttribute attribute : JewelryAttribute.values())
    {
        if (attribute.hasAttribute(nbt) && attribute.getAmount(nbt) < 1)
            tooltip.add(TextFormatting.BLUE + " +" + String.format("%.0f%%", attribute.getAmount(nbt) * 100) + " " + attribute.getName());
        else if (attribute.hasAttribute(nbt) && attribute.getAmount(nbt) >= 1)
            tooltip.add(TextFormatting.BLUE + " +" + format.format(attribute.getAmount(nbt)) + " " + attribute.getName());
    }

    tooltip.add("");
}
项目:InControl    文件:CmdLoadLoot.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (!RulesManager.readCustomLoot(args[0])) {
        ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.RED + "Error reading file '" + args[0] + "'!"));
        InControl.logger.warn("Error reading file '" + args[0] + "'!");
    }
}
项目:AuthMod    文件:Commandlogout.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    EntityPlayer player = (EntityPlayer) sender;
        if( Main.logged.contains(player.getName())){
            Main.logged.remove(player.getName());
            Main.posX.put(player.getName(), player.posX);
            Main.posY.put(player.getName(), player.posY);
            Main.posZ.put(player.getName(), player.posZ);
            Main.time.put(player.getName(),0);
            player.addChatMessage(new TextComponentString(TextFormatting.GREEN + (String)Main.config.get("disconnectedmessage")));
        }
        else {
            player.addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("notloggedin")));
        }
    }
项目:MineCamera    文件:BlockPictureFrameMultiple.java   
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
    tooltip.add(TextFormatting.BLUE + I18n.format("lore.pictureframe_multiple.info"));
    tooltip.add(TextFormatting.BLUE + I18n.format("lore.pictureframe_multiple.info2"));
    tooltip.add(TextFormatting.BLUE + I18n.format("lore.pictureframe_multiple.info3"));
}
项目:TheOink    文件:OinkTools.java   
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {

    int damage = stack.getMaxDamage() - stack.getItemDamage() ;

    tooltip.add("Uses Left: \u00A7c" + damage);
    if (GuiScreen.isShiftKeyDown()) {
        tooltip.add(tooltipInfo);
    }
    if (!GuiScreen.isShiftKeyDown())
        tooltip.add(TextFormatting.AQUA + I18n.format("press.for.info.name", "SHIFT"));
}
项目:Backmemed    文件:Enchantment.java   
/**
 * Returns the correct traslated name of the enchantment and the level in roman numbers.
 */
public String getTranslatedName(int level)
{
    String s = I18n.translateToLocal(this.getName());

    if (this.func_190936_d())
    {
        s = TextFormatting.RED + s;
    }

    return level == 1 && this.getMaxLevel() == 1 ? s : s + " " + I18n.translateToLocal("enchantment.level." + level);
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
public static void mainMenuMouseClick(int mouseX, int mouseY, int mouseButton, FontRenderer font, int width)
{
    if (!Loader.instance().java8)
    {
        if (mouseY >= (4 + (8 * 10)) && mouseY < (4 + (10 * 10)))
        {
            int w = font.getStringWidth(I18n.format("fml.messages.java8warning.1", TextFormatting.RED, TextFormatting.RESET));
            w = Math.max(w, font.getStringWidth(I18n.format("fml.messages.java8warning.2")));
            if (mouseX >= ((width - w) / 2) && mouseX <= ((width + w) / 2))
            {
                FMLClientHandler.instance().showGuiScreen(new GuiJava8Error(new Java8VersionException(Collections.<ModContainer>emptyList())));
            }
        }
    }
}
项目:CustomWorldGen    文件:GuiGameOver.java   
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    boolean flag = this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled();
    this.drawGradientRect(0, 0, this.width, this.height, 1615855616, -1602211792);
    GlStateManager.pushMatrix();
    GlStateManager.scale(2.0F, 2.0F, 2.0F);
    this.drawCenteredString(this.fontRendererObj, I18n.format(flag ? "deathScreen.title.hardcore" : "deathScreen.title", new Object[0]), this.width / 2 / 2, 30, 16777215);
    GlStateManager.popMatrix();

    if (this.causeOfDeath != null)
    {
        this.drawCenteredString(this.fontRendererObj, this.causeOfDeath.getFormattedText(), this.width / 2, 85, 16777215);
    }

    this.drawCenteredString(this.fontRendererObj, I18n.format("deathScreen.score", new Object[0]) + ": " + TextFormatting.YELLOW + this.mc.thePlayer.getScore(), this.width / 2, 100, 16777215);

    if (this.causeOfDeath != null && mouseY > 85 && mouseY < 85 + this.fontRendererObj.FONT_HEIGHT)
    {
        ITextComponent itextcomponent = this.getClickedComponentAt(mouseX);

        if (itextcomponent != null && itextcomponent.getStyle().getHoverEvent() != null)
        {
            this.handleComponentHover(itextcomponent, mouseX, mouseY);
        }
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
项目:pnc-repressurized    文件:GuiAssemblyController.java   
private List<String> getStatusText() {
    List<String> text = new ArrayList<String>();

    List<IAssemblyMachine> machineList = te.getMachines();
    boolean platformFound = false;
    boolean drillFound = false;
    boolean laserFound = false;
    boolean IOUnitExportFound = false;
    boolean IOUnitImportFound = false;
    text.add("\u00a77Machine Status:");
    for (IAssemblyMachine machine : machineList) {
        if (machine instanceof TileEntityAssemblyPlatform) {
            platformFound = true;
            text.add(TextFormatting.GREEN + "-Assembly Platform online");
        } else if (machine instanceof TileEntityAssemblyDrill) {
            drillFound = true;
            text.add(TextFormatting.GREEN + "-Assembly Drill online");
        } else if (machine instanceof TileEntityAssemblyIOUnit) {
            if (((TileEntityAssemblyIOUnit) machine).isImportUnit()) {
                IOUnitImportFound = true;
                text.add(TextFormatting.GREEN + "-Assembly IO Unit (import) online");
            } else {
                IOUnitExportFound = true;
                text.add(TextFormatting.GREEN + "-Assembly IO Unit (export) online");
            }
        } else if (machine instanceof TileEntityAssemblyLaser) {
            laserFound = true;
            text.add(TextFormatting.GREEN + "-Assembly Laser online");
        }
    }
    if (!platformFound) text.add(TextFormatting.DARK_RED + "-Assembly Platform offline");
    if (!drillFound) text.add(TextFormatting.DARK_RED + "-Assembly Drill offline");
    if (!laserFound) text.add(TextFormatting.DARK_RED + "-Assembly Laser offline");
    if (!IOUnitExportFound) text.add(TextFormatting.DARK_RED + "-Assembly IO Unit (export) offline");
    if (!IOUnitImportFound) text.add(TextFormatting.DARK_RED + "-Assembly IO Unit (import) offline");
    return text;
}
项目:VanillaExtras    文件:GuiBlockBreaker.java   
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    String s;
    if (chiptype == 0) {
        s = I18n.format("container.blockbreaker_basic");
    } else if (chiptype == 1) {
        s = I18n.format("container.blockbreaker_advanced");
    } else {
        s = I18n.format("container.blockbreaker");
    }
    this.mc.fontRendererObj.drawString(s, this.xSize / 2 - this.mc.fontRendererObj.getStringWidth(s) / 2, 6,
            4210752);
    this.mc.fontRendererObj.drawString(this.playerInv.getDisplayName().getFormattedText(), 8, 72, 4210752);
    this.progressBar.setMin(cooldown).setMax(maxCooldown);
    this.progressBar.draw(this.mc);

    int actualMouseX = mouseX - ((this.width - this.xSize) / 2);
    int actualMouseY = mouseY - ((this.height - this.ySize) / 2);
    if (actualMouseX >= 134 && actualMouseX <= 149 && actualMouseY >= 17 && actualMouseY <= 32
            && te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
                    .getStackInSlot(9) == ItemStack.EMPTY) {
        List<String> text = new ArrayList<String>();
        text.add(TextFormatting.GRAY + I18n.format("gui.blockbreaker.enchantedbook.tooltip"));
        this.drawHoveringText(text, actualMouseX, actualMouseY);
    }

    sync++;
    sync %= 10;
    if (sync == 0)
        PacketHandler.NETWORKINSTANCE
                .sendToServer(new PacketGetWorker(this.te.getPos(), this.mc.player.getAdjustedHorizontalFacing(),
                        "ivansteklow.vanillaex.client.gui.GuiBlockBreaker", "cooldown", "maxCooldown"));

}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
public void displayGui(IInteractionObject guiOwner)
{
    if (guiOwner instanceof ILootContainer && ((ILootContainer)guiOwner).getLootTable() != null && this.isSpectator())
    {
        this.addChatComponentMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)), true);
    }
    else
    {
        this.getNextWindowId();
        this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, guiOwner.getGuiID(), guiOwner.getDisplayName()));
        this.openContainer = guiOwner.createContainer(this.inventory, this);
        this.openContainer.windowId = this.currentWindowId;
        this.openContainer.addListener(this);
    }
}
项目:pnc-repressurized    文件:GuiPneumaticDynamo.java   
private List<String> getOutputStat() {
    List<String> textList = new ArrayList<>();
    textList.add(TextFormatting.GRAY + "Maximum RF production:");
    textList.add(TextFormatting.BLACK.toString() + te.getRFRate() + " RF/tick");
    textList.add(TextFormatting.GRAY + "Maximum output rate:");
    textList.add(TextFormatting.BLACK.toString() + te.getRFRate() * 2 + " RF/tick");
    textList.add(TextFormatting.GRAY + "Current stored RF:");
    textList.add(TextFormatting.BLACK.toString() + te.getInfoEnergyStored() + " RF");
    return textList;
}
项目:Randores2    文件:TomeGui.java   
public TomeGui(List<Element> pages) {
    this.pages = pages;
    this.currentPage = 0;
    if (pages.isEmpty()) {
        this.pages.add(new StringElement(TextFormatting.RED + "Error: no pages present", RandoresKeys.ERROR));
    }
}
项目:Mods    文件:ItemFromData.java   
@Override
public String getItemStackDisplayName(ItemStack stack) {
    if (ItemFromData.getData(stack) == BLANK_DATA)
        return "Weapon";
    String name = ItemFromData.getData(stack).getString(PropertyType.NAME);
    if (stack.getTagCompound().getBoolean("Strange"))
        name = TextFormatting.GOLD
                + TF2EventsCommon.STRANGE_TITLES[stack.getTagCompound().getInteger("StrangeLevel")] + " "
                + name;
    if (stack.getTagCompound().getBoolean("Australium"))
        name = TextFormatting.GOLD + "Australium " + name;
    if (stack.getTagCompound().getBoolean("Valve"))
        name = TextFormatting.DARK_PURPLE + "Valve " + name;
    return name;
}
项目:Infernum    文件:ItemSpellPage.java   
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
    if (!getSpell(stack).equals(Spell.EMPTY_SPELL)) {
        tooltip.add(TextFormatting.DARK_RED + "" + TextFormatting.ITALIC
                + I18n.translateToLocal(getSpell(stack).getUnlocalizedName() + ".name"));
    }
}
项目:Randores2    文件:TomeItem.java   
@Override
public String getItemStackDisplayName(ItemStack stack) {
    if (RandoresItemData.hasData(stack)) {
        RandoresItemData data = new RandoresItemData(stack);
        return RandoresWorldData.delegate(data, def -> TextFormatting.GREEN + I18n.format(RandoresKeys.TOME).replace("${name}", def.getName()), () -> super.getItemStackDisplayName(stack));
    }

    return super.getItemStackDisplayName(stack);
}
项目:uniquecrops    文件:ItemPoncho.java   
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean whatisthis) {

    if (stack.hasTagCompound() && stack.getTagCompound().hasKey(ItemGeneric.TAG_UPGRADE)) {
        int upgradelevel = stack.getTagCompound().getInteger(ItemGeneric.TAG_UPGRADE);
        list.add(TextFormatting.GOLD + "+" + upgradelevel);
    }
    else
        list.add(TextFormatting.GOLD + "Upgradeable");
}
项目:pnc-repressurized    文件:GuiElectrostaticCompressor.java   
@Override
protected void addProblems(List<String> textList) {
    super.addProblems(textList);
    if (PneumaticValues.MAX_REDIRECTION_PER_IRON_BAR * te.ironBarsBeneath < PneumaticValues.PRODUCTION_ELECTROSTATIC_COMPRESSOR / connectedCompressors) {
        textList.add(TextFormatting.GRAY + "When lightning strikes with a full air tank not all the energy can be redirected!");
        textList.add(TextFormatting.BLACK + "Connect up more Iron Bars to the underside of the Electrostatic Compressor.");
    }
}
项目:Solar    文件:TooltipBuilder.java   
public TooltipBuilder add(Object object, TextFormatting... formats) {
    for(TextFormatting format : formats) {
        builder.append(format);
    }
    builder.append(object);
    return this;
}
项目:UniversalRemote    文件:TextFormatter.java   
public static ITextComponent style(TextFormatting color, String unstyledString, Object... args)
{
    TextComponentString t = new TextComponentString(String.format(unstyledString, args));
    Style s = new Style();
    s.setColor(color);
    t.setStyle(s);

    return t;
}
项目:pnc-repressurized    文件:GuiElectricCompressor.java   
@Override
protected void addProblems(List<String> textList) {
    super.addProblems(textList);
    if (te.lastEnergyProduction == 0) {
        textList.add(TextFormatting.GRAY + "There is no EU input!");
        textList.add(TextFormatting.BLACK + "Add a (bigger) EU supply to the network.");
    }
    if (te.getEfficiency() < 100) {
        textList.add(I18n.format("gui.tab.problems.advancedAirCompressor.efficiency", te.getEfficiency() + "%%"));
    }
}
项目:Mods    文件:TF2EventsCommon.java   
@SubscribeEvent
public void loadWorld(WorldEvent.Load event) {
    /*if (!event.getWorld().isRemote && event.getWorld().getPerWorldStorage().getOrLoadData(TF2WorldStorage.class, TF2weapons.MOD_ID)==null){
        event.getWorld().getPerWorldStorage().setData(TF2weapons.MOD_ID, new TF2WorldStorage());
        dummyEnt = new EntityCreeper(null);
    }*/
    TF2weapons.dummyEnt = new EntityCreeper(event.getWorld());
    if(!event.getWorld().getGameRules().hasRule("doTF2AI"))
        event.getWorld().getGameRules().addGameRule("doTF2AI", "true", ValueType.BOOLEAN_VALUE);
    if (!event.getWorld().isRemote && event.getWorld().getScoreboard().getTeam("RED") == null) {
        ScorePlayerTeam teamRed = event.getWorld().getScoreboard().createTeam("RED");
        ScorePlayerTeam teamBlu = event.getWorld().getScoreboard().createTeam("BLU");

        teamRed.setSeeFriendlyInvisiblesEnabled(true);
        teamRed.setAllowFriendlyFire(false);
        teamBlu.setSeeFriendlyInvisiblesEnabled(true);
        teamBlu.setAllowFriendlyFire(false);
        teamRed.setPrefix(TextFormatting.RED.toString());
        teamBlu.setPrefix(TextFormatting.BLUE.toString());
        teamRed.setColor(TextFormatting.RED);
        teamBlu.setColor(TextFormatting.BLUE);
        event.getWorld().getScoreboard().broadcastTeamInfoUpdate(teamRed);
        event.getWorld().getScoreboard().broadcastTeamInfoUpdate(teamBlu);

    }
    if (!event.getWorld().isRemote && event.getWorld().getScoreboard().getTeam("TF2Bosses") == null) {
        ScorePlayerTeam teamBosses = event.getWorld().getScoreboard().createTeam("TF2Bosses");
        teamBosses.setSeeFriendlyInvisiblesEnabled(true);
        teamBosses.setAllowFriendlyFire(false);
        teamBosses.setPrefix(TextFormatting.DARK_PURPLE.toString());
        teamBosses.setColor(TextFormatting.DARK_PURPLE);
        event.getWorld().getScoreboard().broadcastTeamInfoUpdate(teamBosses);
    }
    if (!event.getWorld().isRemote && event.getWorld().getScoreboard().getTeam("RED").getColor() == TextFormatting.RESET) {
        event.getWorld().getScoreboard().getTeam("RED").setColor(TextFormatting.RED);
        event.getWorld().getScoreboard().getTeam("BLU").setColor(TextFormatting.BLUE);
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayServer.java   
public void processRightClickBlock(CPacketPlayerTryUseItemOnBlock packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    EnumHand enumhand = packetIn.getHand();
    ItemStack itemstack = this.playerEntity.getHeldItem(enumhand);
    BlockPos blockpos = packetIn.getPos();
    EnumFacing enumfacing = packetIn.getDirection();
    this.playerEntity.markPlayerActive();

    if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit())
    {
        if (this.targetPos == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos))
        {
            this.playerEntity.interactionManager.processRightClickBlock(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, packetIn.getFacingX(), packetIn.getFacingY(), packetIn.getFacingZ());
        }
    }
    else
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("build.tooHigh", new Object[] {Integer.valueOf(this.serverController.getBuildLimit())});
        textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
        this.playerEntity.connection.sendPacket(new SPacketChat(textcomponenttranslation, (byte)2));
    }

    this.playerEntity.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos));
    this.playerEntity.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos.offset(enumfacing)));
}
项目:MeeCreeps    文件:GuiWheel.java   
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);
    GlStateManager.enableBlend();
    mc.getTextureManager().bindTexture(background);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, WIDTH, HEIGHT);

    int cx = mouseX - guiLeft - WIDTH / 2;
    int cy = mouseY - guiTop - HEIGHT / 2;
    int offset = 8 / 2;
    lastSelected = getSelectedSection(cx, cy);
    if (lastSelected != -1) {
        drawSelectedSection(offset, lastSelected, 0);
        if (lastSelected < 8) {
            drawTooltip(lastSelected);
        }
    }

    int currentDestination = PortalGunItem.getCurrentDestination(PortalGunItem.getGun(mc.player));
    if (currentDestination != -1) {
        drawSelectedSection(offset, currentDestination, 128);
    }

    drawIcons(offset, lastSelected);

    if (lastSelected != -1) {
        if (lastSelected < 8) {
            List<TeleportDestination> destinations = PortalGunItem.getDestinations(PortalGunItem.getGun(Minecraft.getMinecraft().player));
            TeleportDestination destination = destinations.get(lastSelected);
            List<String> tooltips = new ArrayList<>();
            if (destination == null) {
                tooltips.add(TextFormatting.BLUE + "Click: " + TextFormatting.WHITE + "to set current location as destination");
            } else {
                tooltips.add(TextFormatting.BLUE + "Click: " + TextFormatting.WHITE + "to set this destination as current");
                tooltips.add(TextFormatting.BLUE + "Del: " + TextFormatting.WHITE + "to remove this destination");
            }
            drawHoveringText(tooltips, mouseX, mouseY);
        }
    }
}
项目:InControl    文件:CmdLoadPotentialSpawn.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (!RulesManager.readCustomPotentialSpawn(args[0])) {
        ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.RED + "Error reading file '" + args[0] + "'!"));
        InControl.logger.warn("Error reading file '" + args[0] + "'!");
    }
}
项目:Infernum    文件:ItemSpellBook.java   
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
    if (!getSpell(stack).equals(Spell.EMPTY_SPELL)) {
        tooltip.add(TextFormatting.DARK_RED + "" + TextFormatting.ITALIC
                + I18n.translateToLocal(getSpell(stack).getUnlocalizedName() + ".name"));
    }
}
项目:pnc-repressurized    文件:ItemPneumatic.java   
public static void addTooltip(ItemStack stack, World world, List<String> curInfo) {
    String info = "gui.tooltip." + stack.getUnlocalizedName();//getItem().getUnlocalizedName();
    String translatedInfo = I18n.format(info);
    if (!translatedInfo.equals(info)) {
        if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
            translatedInfo = TextFormatting.AQUA + translatedInfo;
            if (!Loader.isModLoaded(ModIds.IGWMOD))
                translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW");
            curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 40));
        } else {
            curInfo.add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo"));
        }
    }
}