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

下面列出了怎么用net.minecraft.util.text.TextFormatting的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: enderutilities   文件: ItemPickupManager.java
@Override
public String getItemStackDisplayName(ItemStack stack)
{
    int preset = NBTUtils.getByte(stack, TAG_NAME_CONTAINER, TAG_NAME_PRESET_SELECTION);
    int lc = UtilItemModular.getStoredModuleSelection(stack, ModuleType.TYPE_LINKCRYSTAL);
    String pre = TextFormatting.GREEN.toString();
    String rst = TextFormatting.RESET.toString() + TextFormatting.WHITE.toString();
    String str = " - pre: " + pre + (preset + 1) + rst + " LC: " + pre + lc + rst;
    String target = this.getTargetDisplayName(stack);

    if (target != null)
    {
        str = str + " - " + pre + target + rst;
    }

    return this.getBaseItemDisplayName(stack) + str;
}
 
源代码2 项目: bleachhack-1.14   文件: Freecam.java
public void onEnable() {
	playerPos = new double[]{mc.player.posX,mc.player.posY,mc.player.posZ};
	
	camera = new BoatEntity(mc.world, mc.player.posX, mc.player.posY, mc.player.posZ);
	camera.copyLocationAndAnglesFrom(mc.player);
	camera.entityCollisionReduction = 1;
	
	dummy = new ArmorStandEntity(mc.world, mc.player.posX, mc.player.posY, mc.player.posZ);
	dummy.copyLocationAndAnglesFrom(mc.player);
	dummy.setBoundingBox(dummy.getBoundingBox().grow(0.1));
	EntityUtils.setGlowing(dummy, TextFormatting.RED, "starmygithubpls");
	
	mc.world.addEntity(camera.getEntityId(), camera);
	mc.world.addEntity(dummy.getEntityId(), dummy);
	mc.renderViewEntity = camera;
}
 
源代码3 项目: Moo-Fluids   文件: FluidCowEntityProvider.java
@Override
public List<String> getWailaBody(Entity entity, List<String> currenttip,
                                 IWailaEntityAccessor accessor, IWailaConfigHandler config) {
  if (accessor.getEntity() instanceof EntityFluidCow) {
    final EntityFluidCow entityFluidCow = (EntityFluidCow) accessor.getEntity();
    final FluidStack fluidStack = new FluidStack(entityFluidCow.getEntityFluid(), 0);

    currenttip.add(String.format(
        TextFormatting.WHITE +
        LocalizationHelper.localize(UnlocalizedStrings.FLUID_TOOLTIP),
        TextFormatting.AQUA +
        entityFluidCow.getEntityFluid().getLocalizedName(fluidStack)));

    currenttip.add(String.format(
        TextFormatting.WHITE +
        LocalizationHelper.localize(UnlocalizedStrings.NEXT_USE_TOOLTIP),
        TextFormatting.AQUA +
        TooltipHelper.getTimeUntilNextUse(entityFluidCow.getNextUseCooldown() / 20)));
  }

  return currenttip;
}
 
源代码4 项目: YUNoMakeGoodMap   文件: GuiCustomizeWorld.java
@Override
protected void elementClicked(int index, boolean doubleClick)
{
    if (index == this.selected)
        return;
    this.selected = index;

    StructInfo info = GuiCustomizeWorld.this.getInfo(list.get(index));
    if (info != null)
    {
        List<String> lines = Lists.newArrayList();
        if (info.description != null)
        {
            for (String line : info.description)
                lines.add(line);
        }
        else
        {
            lines.add(TextFormatting.RED + "NO INFORMATION FOUND");
            lines.add(TextFormatting.RED + "Please add a jsonfile with description information.");
        }
        GuiCustomizeWorld.this.info = new Info(GuiCustomizeWorld.this.width - LIST_WIDTH - 30,
                lines, info.logoPath, info.logoSize);
    }
}
 
源代码5 项目: GregTech   文件: MultiblockInfoRecipeWrapper.java
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
    if (tooltipBlockStack != null && !tooltipBlockStack.isEmpty() && !Mouse.isButtonDown(0)) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ITooltipFlag flag = minecraft.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL;
        List<String> tooltip = tooltipBlockStack.getTooltip(minecraft.player, flag);
        EnumRarity rarity = tooltipBlockStack.getRarity();
        for (int k = 0; k < tooltip.size(); ++k) {
            if (k == 0) {
                tooltip.set(k, rarity.rarityColor + tooltip.get(k));
            } else {
                tooltip.set(k, TextFormatting.GRAY + tooltip.get(k));
            }
        }
        return tooltip;
    }
    return Collections.emptyList();
}
 
源代码6 项目: enderutilities   文件: ItemVoidPickaxe.java
@Override
public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose)
{
    String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString();
    String preGreen = TextFormatting.GREEN.toString();
    String modeStr;

    if (this.isFastMode(stack))
    {
        modeStr = I18n.format("enderutilities.tooltip.item.fast");
    }
    else
    {
        modeStr = I18n.format("enderutilities.tooltip.item.normal");
    }

    list.add(I18n.format("enderutilities.tooltip.item.mode") + ": " + preGreen + modeStr + rst);
}
 
源代码7 项目: GregTech   文件: MetaTileEntityLargeTurbine.java
@Override
protected void addDisplayText(List<ITextComponent> textList) {
    if (isStructureFormed()) {
        MetaTileEntityRotorHolder rotorHolder = getAbilities(ABILITY_ROTOR_HOLDER).get(0);
        FluidStack fuelStack = ((LargeTurbineWorkableHandler) workableHandler).getFuelStack();
        int fuelAmount = fuelStack == null ? 0 : fuelStack.amount;

        ITextComponent fuelName = new TextComponentTranslation(fuelAmount == 0 ? "gregtech.fluid.empty" : fuelStack.getUnlocalizedName());
        textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.fuel_amount", fuelAmount, fuelName));

        if (rotorHolder.getRotorEfficiency() > 0.0) {
            textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_speed", rotorHolder.getCurrentRotorSpeed(), rotorHolder.getMaxRotorSpeed()));
            textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_efficiency", (int) (rotorHolder.getRotorEfficiency() * 100)));
            int rotorDurability = (int) (rotorHolder.getRotorDurability() * 100);
            if (rotorDurability > MIN_DURABILITY_TO_WARN) {
                textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_durability", rotorDurability));
            } else {
                textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.low_rotor_durability",
                    MIN_DURABILITY_TO_WARN, rotorDurability).setStyle(new Style().setColor(TextFormatting.RED)));
            }
        }
    }
    super.addDisplayText(textList);
}
 
源代码8 项目: GregTech   文件: BlockSurfaceRockNew.java
@Override
public List<ITextComponent> getMagnifyResults(IBlockAccess world, BlockPos pos, IBlockState blockState, EntityPlayer player) {
    TileEntitySurfaceRock tileEntity = getTileEntity(world, pos);
    if (tileEntity == null) {
        return Collections.emptyList();
    }
    List<Material> materials = tileEntity.getUndergroundMaterials();
    ITextComponent materialComponent = new TextComponentTranslation(tileEntity.getMaterial().getUnlocalizedName());
    materialComponent.getStyle().setColor(TextFormatting.GREEN);
    ITextComponent baseComponent = new TextComponentString("");
    ITextComponent separator = new TextComponentString(", ");
    separator.getStyle().setColor(TextFormatting.GRAY);
    for (int i = 0; i < materials.size(); i++) {
        ITextComponent extraComponent = new TextComponentTranslation(materials.get(i).getUnlocalizedName());
        extraComponent.getStyle().setColor(TextFormatting.YELLOW);
        baseComponent.appendSibling(extraComponent);
        if (i + 1 != materials.size()) baseComponent.appendSibling(separator);
    }
    ArrayList<ITextComponent> result = new ArrayList<>();
    result.add(new TextComponentTranslation("gregtech.block.surface_rock.material", materialComponent));
    result.add(new TextComponentTranslation("gregtech.block.surface_rock.underground_materials", baseComponent));
    return result;
}
 
源代码9 项目: TFC2   文件: ItemPotteryVessel.java
@Override
public void addInformation(ItemStack is, EntityPlayer player, List arraylist, boolean flag)
{
	super.addInformation(is, player, arraylist, flag);
	if(is.hasTagCompound() && is.getTagCompound().hasKey("Items"))
	{
		NBTTagList nbttaglist = is.getTagCompound().getTagList("Items", 10);
		for(int i = 0; i < nbttaglist.tagCount(); i++)
		{
			NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
			byte byte0 = nbttagcompound1.getByte("Slot");
			if(byte0 >= 0 && byte0 < 4)
			{
				ItemStack stackStored = new ItemStack(nbttagcompound1);
				arraylist.add(TextFormatting.DARK_GRAY + ""+stackStored.getCount() + "x " + stackStored.getDisplayName());
			}
		}
	}
	//arraylist.add(TextFormatting.DARK_GRAY + Core.translate(name[is.getItemDamage()]));
}
 
源代码10 项目: GT-Classic   文件: GTCommandTeleport.java
@Override
public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args)
		throws CommandException {
	if (!IC2.platform.isOp(sender.getCommandSenderEntity().getUniqueID())) {
		sender.sendMessage(new TextComponentString(TextFormatting.RED
				+ "You do not have permission to use this command"));
		return;
	}
	if (args.length < 1) {
		return;
	}
	String s = args[0];
	int dim;
	try {
		dim = Integer.parseInt(s);
	} catch (NumberFormatException e) {
		sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error parsing dimension!"));
		return;
	}
	if (sender instanceof EntityPlayer) {
		GTCommandTeleporter.teleportToDimension((EntityPlayer) sender, dim, 0, 100, 0);
	}
}
 
源代码11 项目: BakaDanmaku   文件: DanmakuThreadFactory.java
/**
 * 启动指定平台的 DanmakuThread
 *
 * @param platform 平台名
 */
public static void runThread(String platform) {
    // 先获取当前正在运行的弹幕线程
    BaseDanmakuThread dmThread = getDanmakuThread(platform);

    // 如果正在运行的弹幕线程为空
    if (dmThread != null) {
        // 将弹幕开启的指示参数设定为 true
        dmThread.keepRunning = true;

        // 而后重新 new 线程,并启动线程
        Thread threadToRun = new Thread(dmThread, platform + "DanmakuThread");
        threadToRun.start();

        // 在存储实际运行的 map 中存入这个线程
        realDanmakuThreads.put(platform, threadToRun);
    } else {
        // 发送错误信息
        BakaDanmaku.logger.error("平台 [" + platform + "] 不存在!请检查配置文件或已安装 Mod!");
        BaseDanmakuThread.sendChatMessage(TextFormatting.RED + "弹幕姬错误:");
        BaseDanmakuThread.sendChatMessage(TextFormatting.RED + "平台 [" + platform + "] 不存在!请检查配置文件或已安装 Mod!");
    }
}
 
源代码12 项目: ExNihiloAdscensio   文件: BlockSieve.java
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world,
		IBlockState blockState, IProbeHitData data) {
	
	TileSieve sieve = (TileSieve) world.getTileEntity(data.getPos());
	if (sieve == null)
		return;
	
	if (sieve.getMeshStack() == null) {
		probeInfo.text("Mesh: None");
		return;
	}
	probeInfo.text("Mesh: " + I18n.format(sieve.getMeshStack().getUnlocalizedName() + ".name"));
	
	if (mode == ProbeMode.EXTENDED) {
		Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(sieve.getMeshStack());
		for (Enchantment enchantment : enchantments.keySet()) {
			probeInfo.text(TextFormatting.BLUE + enchantment.getTranslatedName(enchantments.get(enchantment)));
		}
	}
	
}
 
源代码13 项目: Signals   文件: ItemTicket.java
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand){
    ItemStack stack = player.getHeldItem(hand);
    if(!world.isRemote) {
        TileEntity te = world.getTileEntity(pos);
        if(te instanceof TileEntityStationMarker) {
            TileEntityStationMarker stationMarker = (TileEntityStationMarker)te;
            String stationName = stationMarker.getStationName();

            appendDestination(stack, stationName);

            String concatDestinations = getConcattedDestinations(stack);
            player.sendMessage(new TextComponentTranslation("signals.message.added_destination", TextFormatting.GOLD + stationName + TextFormatting.WHITE, TextFormatting.GOLD + concatDestinations + TextFormatting.WHITE));

            return EnumActionResult.SUCCESS;
        }
    }
    return super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand);
}
 
源代码14 项目: WearableBackpacks   文件: BaseEntryList.java
public BaseEntryList(int width, List<T> defaultValue, List<T> previousValue) {
	super(Direction.VERTICAL);
	setCenteredHorizontal(width);

	this.defaultValue  = defaultValue;
	this.previousValue = previousValue;

	layoutList = new GuiLayout(Direction.VERTICAL);
	layoutList.setFillHorizontal();

	buttonAdd = new GuiButton(0, DEFAULT_ENTRY_HEIGHT, TextFormatting.GREEN + "+");
	buttonAdd.setFill();
	buttonAdd.setAction(this::addButtonPressed);

	addFixed(layoutList);
	addFixed(buttonAdd);

	setValue(previousValue);
}
 
源代码15 项目: NotEnoughItems   文件: NEIServerUtils.java
public static void givePlayerItem(EntityPlayerMP player, ItemStack stack, boolean infinite, boolean doGive) {
    if (stack.getItem() == null) {
        player.sendMessage(setColour(new TextComponentTranslation("nei.chat.give.noitem"), TextFormatting.WHITE));
        return;
    }

    int given = stack.getCount();
    if (doGive) {
        if (infinite) {
            player.inventory.addItemStackToInventory(stack);
        } else {
            given -= InventoryUtils.insertItem(player.inventory, stack, false);
        }
    }

    sendNotice(player, new TextComponentTranslation("commands.give.success", stack.getTextComponent(), infinite ? "\u221E" : Integer.toString(given), player.getName()), "notify-item");
    player.openContainer.detectAndSendChanges();
}
 
源代码16 项目: Better-Sprinting   文件: GuiButtonInputBinding.java
public void updateKeyBindingText(){
	boolean hasConflict = false;
	boolean hasOnlyModifierConflict = true;
	
	if (!binding.isInvalid()){
		for(KeyBinding other:settings.keyBindings){
			if (binding != other && binding.conflicts(other)){
				hasConflict = true;
				hasOnlyModifierConflict &= binding.hasKeyCodeModifierConflict(other);
			}
		}
	}
	
	if (isSelected){
		setMessage(TextFormatting.WHITE + "> " + TextFormatting.YELLOW + binding.getLocalizedName() + TextFormatting.WHITE + " <");
	}
	else if (hasConflict){
		setMessage((hasOnlyModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + binding.getLocalizedName());
	}
	else{
		setMessage(binding.getLocalizedName());
	}
}
 
源代码17 项目: TofuCraftReload   文件: ItemTofuForceSword.java
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
    if (!isUsable(stack)) {
        tooltip.add(TextFormatting.ITALIC + I18n.format("tooltip.tofucraft.tofuforce_core.broken"));
    }
    tooltip.add(I18n.format("tooltip.tofucraft.energy", getEnergy(stack), getEnergyMax(stack)));
    super.addInformation(stack, worldIn, tooltip, flagIn);
}
 
源代码18 项目: TofuCraftReload   文件: ItemTofuForceCore.java
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
    tooltip.add(I18n.format("tooltip.tofucraft.tofuforce_core1"));
    //tooltip.add(I18n.translateToLocal("tooltip.tofucraft.tofuforce_core2"));
    tooltip.add("");
    if (!isUsable(stack)) {
        tooltip.add(TextFormatting.ITALIC + I18n.format("tooltip.tofucraft.tofuforce_core.broken"));
    }
    super.addInformation(stack, worldIn, tooltip, flagIn);
}
 
源代码19 项目: FastAsyncWorldedit   文件: ForgePlayer.java
private void sendColorized(String msg, TextFormatting formatting) {
    for (String part : msg.split("\n")) {
        TextComponentString component = new TextComponentString(part);
        component.getStyle().setColor(formatting);
        this.player.sendMessage(component);
    }
}
 
源代码20 项目: enderutilities   文件: ItemLocationBound.java
@Override
public String getItemStackDisplayName(ItemStack stack)
{
    if (this.shouldDisplayTargetName(stack))
    {
        String targetName = this.getTargetDisplayName(stack);
        String pre = TextFormatting.GREEN.toString();
        String rst = TextFormatting.RESET.toString() + TextFormatting.WHITE.toString();

        return this.getBaseItemDisplayName(stack) + " " + pre + targetName + rst;
    }

    return super.getBaseItemDisplayName(stack);
}
 
源代码21 项目: malmo   文件: AgentQuitFromTimeUpImplementation.java
@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);
}
 
源代码22 项目: enderutilities   文件: ItemMobHarness.java
@Override
public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose)
{
    if (stack.getTagCompound() == null || this.hasTarget(stack) == false)
    {
        list.add(I18n.format("enderutilities.tooltip.item.notlinked"));
        return;
    }

    String target = stack.getTagCompound().getString("TargetName");
    list.add(I18n.format("enderutilities.tooltip.item.linked") + ": " + TextFormatting.GREEN + target + TextFormatting.RESET + TextFormatting.GRAY);
}
 
源代码23 项目: enderutilities   文件: NBTUtils.java
/**
 * Adds ready formatted description of the stored items in a cached tag to the list provided.<br>
 * @param stack
 * @param lines
 * @param maxItemLines
 */
public static void getCachedInventoryStrings(ItemStack stack, List<String> lines, int maxItemLines)
{
    NBTTagCompound wrapper = getCompoundTag(stack, "InvCache", false);

    if (wrapper == null)
    {
        return;
    }

    String preWhite = TextFormatting.WHITE.toString();
    String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString();
    NBTTagList list = wrapper.getTagList("il", Constants.NBT.TAG_COMPOUND);
    final int totalStacks = wrapper.getInteger("ts");
    final int numLines = Math.min(list.tagCount(), maxItemLines);
    String countStr = EUStringUtils.formatNumberWithKSeparators(wrapper.getLong("ti"));

    lines.add(EnderUtilities.proxy.format("enderutilities.tooltip.item.memorycard.items.stackcount", totalStacks, countStr));

    for (int i = 0; i < numLines; i++)
    {
        NBTTagCompound tag = list.getCompoundTagAt(i);
        countStr = EUStringUtils.formatNumberWithKSeparators(tag.getInteger("c"));
        lines.add(String.format("  %s%s%s %s", preWhite, countStr, rst, tag.getString("dn")));
    }

    if (totalStacks > maxItemLines)
    {
        lines.add(EnderUtilities.proxy.format("enderutilities.tooltip.item.andmorestacksnotlisted",
                preWhite, totalStacks - maxItemLines, rst));
    }
}
 
源代码24 项目: Levels   文件: GuiArmorSelection.java
private void drawTooltips(NBTTagCompound nbt, int mouseX, int mouseY)
{	
	for (int i = 0; i < attributes.length; i++)
	{
		HoverChecker checker = new HoverChecker(attributes[i], 0);

		if (checker.checkHover(mouseX, mouseY))
		{
			int cost = 1;
			
			if (ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getRarity() == Rarity.UNCOMMON && !ArmorAttribute.ARMOR_ATTRIBUTES.get(i).hasAttribute(nbt)) cost = 1;
			else if (ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getRarity() == Rarity.RARE && !ArmorAttribute.ARMOR_ATTRIBUTES.get(i).hasAttribute(nbt)) cost = 2;
			else if (ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getRarity() == Rarity.LEGENDARY && !ArmorAttribute.ARMOR_ATTRIBUTES.get(i).hasAttribute(nbt)) cost = 3;
			else if (ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getAttributeTier(nbt) == 3) cost = 0;
			
			List<String> list = new ArrayList<String>();
			list.add(ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getColor() + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getName(nbt));
			list.add(TextFormatting.GRAY + "Cost: " + cost + " token(s)");
			list.add("");
			list.add(I18n.format("levels.attributes.armors.info." + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).ordinal()));
			list.add("");
			list.add("Tiers:");
			list.add(" I - " + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getColor() + I18n.format("levels.attributes.armors.info." + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).ordinal() + ".tier1"));
			list.add(" II - " + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getColor() + I18n.format("levels.attributes.armors.info." + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).ordinal() + ".tier2"));
			list.add(" III - " + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).getColor() + I18n.format("levels.attributes.armors.info." + ArmorAttribute.ARMOR_ATTRIBUTES.get(i).ordinal() + ".tier3"));
			drawHoveringText(list, mouseX + 3, mouseY + 3);
		}
	}
}
 
源代码25 项目: MiningGadgets   文件: UpgradeCard.java
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
    super.addInformation(stack, world, tooltip, flag);
    if (stack.getItem() instanceof UpgradeCard) {
        Upgrade upgrade = ((UpgradeCard) stack.getItem()).upgrade;
        int cost = upgrade.getCostPerBlock();
        if (cost > 0)
            tooltip.add(new TranslationTextComponent("mininggadgets.tooltip.item.upgrade_cost", cost).applyTextStyle(TextFormatting.AQUA));

        cost = 0;
        if (upgrade == Upgrade.LIGHT_PLACER)
            cost = Config.UPGRADECOST_LIGHT.get();
        if (upgrade == Upgrade.FREEZING)
            cost = Config.UPGRADECOST_FREEZE.get();
        if (cost > 0)
            tooltip.add(new TranslationTextComponent("mininggadgets.tooltip.item.use_cost", cost).applyTextStyle(TextFormatting.AQUA));

        if( upgrade.getBaseName().equals(Upgrade.BATTERY_1.getBaseName()) ) {
            UpgradeBatteryLevels.getBatteryByLevel(upgrade.getTier()).ifPresent(e -> {
                tooltip.add(new TranslationTextComponent("mininggadgets.tooltip.item.battery_boost", MagicHelpers.tidyValue(e.getPower())).applyTextStyle(TextFormatting.AQUA));
            });
        }

        tooltip.add(new TranslationTextComponent(this.upgrade.getTooltop()).applyTextStyle(TextFormatting.GRAY));
    }

}
 
源代码26 项目: Better-Sprinting   文件: ServerCommandConfig.java
private static int execHelp(CommandContext<CommandSource> ctx){
	CommandSource source = ctx.getSource();
	sendMessage(source, TextFormatting.GREEN + "[Better Sprinting]");
	sendMessage(source, "/bettersprinting info");
	sendMessage(source, "/bettersprinting disablemod <" + ARG_BOOLEAN + ">");
	sendMessage(source, "/bettersprinting setting <" + ARG_SETTINGS + "> <" + ARG_BOOLEAN + ">");
	return 0;
}
 
源代码27 项目: enderutilities   文件: ItemEnderUtilities.java
public String getBaseItemDisplayName(ItemStack stack)
{
    // If the item has been renamed, show that name
    if (stack.hasDisplayName())
    {
        String name = stack.getTagCompound().getCompoundTag("display").getString("Name");
        return TextFormatting.ITALIC.toString() + name + TextFormatting.RESET.toString();
    }

    return super.getItemStackDisplayName(stack);
}
 
源代码28 项目: FastAsyncWorldedit   文件: ForgePlayer.java
private void sendColorized(String msg, TextFormatting formatting) {
    for (String part : msg.split("\n")) {
        TextComponentString component = new TextComponentString(part);
        component.getStyle().setColor(formatting);
        this.player.addChatMessage(component);
    }
}
 
源代码29 项目: GT-Classic   文件: GTItemFluidTube.java
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
	tooltip.add(GTHelperFluid.getFluidName(stack));
	if (GTHelperFluid.isFluidGas(stack)) {
		tooltip.add(TextFormatting.GREEN + I18n.format("Gaseous"));
	}
	if (GTHelperFluid.isFluidPlaceable(stack)) {
		tooltip.add(TextFormatting.YELLOW + I18n.format("Can be placed in world"));
	}
	if (GTHelperFluid.isFluidBurnable(stack)) {
		tooltip.add(TextFormatting.RED + I18n.format("Can be burned as liquid fuel"));
	}
}
 
源代码30 项目: GT-Classic   文件: GTBlockQuantumChest.java
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
	if (stack.hasTagCompound()) {
		NBTTagCompound nbt;
		nbt = StackUtil.getNbtData(stack);
		if (nbt.hasKey(GTTileQuantumChest.NBT_DISPLAYITEM) && nbt.hasKey(GTTileQuantumChest.NBT_DIGITALCOUNT)) {
			tooltip.add(TextFormatting.AQUA + I18n.format((nbt.getInteger(GTTileQuantumChest.NBT_DIGITALCOUNT))
					+ " of "
					+ StackUtil.copyWithSize(new ItemStack(nbt.getCompoundTag(GTTileQuantumChest.NBT_DISPLAYITEM)), 1).getDisplayName()));
		}
	}
	super.addInformation(stack, worldIn, tooltip, flagIn);
}
 
 类所在包
 类方法
 同包方法