Java Code Examples for net.minecraft.util.text.TextFormatting

The following examples show how to use net.minecraft.util.text.TextFormatting. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@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;
}
 
Example 2
Source Project: bleachhack-1.14   Source File: Freecam.java    License: GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 3
@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;
}
 
Example 4
Source Project: YUNoMakeGoodMap   Source File: GuiCustomizeWorld.java    License: Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 5
@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();
}
 
Example 6
@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);
}
 
Example 7
@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);
}
 
Example 8
@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;
}
 
Example 9
Source Project: TFC2   Source File: ItemPotteryVessel.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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()]));
}
 
Example 10
@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);
	}
}
 
Example 11
Source Project: BakaDanmaku   Source File: DanmakuThreadFactory.java    License: MIT License 6 votes vote down vote up
/**
 * 启动指定平台的 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!");
    }
}
 
Example 12
Source Project: ExNihiloAdscensio   Source File: BlockSieve.java    License: MIT License 6 votes vote down vote up
@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)));
		}
	}
	
}
 
Example 13
Source Project: Signals   Source File: ItemTicket.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example 14
Source Project: WearableBackpacks   Source File: BaseEntryList.java    License: MIT License 6 votes vote down vote up
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);
}
 
Example 15
Source Project: NotEnoughItems   Source File: NEIServerUtils.java    License: MIT License 6 votes vote down vote up
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();
}
 
Example 16
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());
	}
}
 
Example 17
Source Project: TofuCraftReload   Source File: ItemTofuForceSword.java    License: MIT License 5 votes vote down vote up
@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);
}
 
Example 18
Source Project: TofuCraftReload   Source File: ItemTofuForceCore.java    License: MIT License 5 votes vote down vote up
@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);
}
 
Example 19
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);
    }
}
 
Example 20
@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);
}
 
Example 21
Source Project: malmo   Source File: AgentQuitFromTimeUpImplementation.java    License: MIT License 5 votes vote down vote up
@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);
}
 
Example 22
@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);
}
 
Example 23
/**
 * 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));
    }
}
 
Example 24
Source Project: Levels   Source File: GuiArmorSelection.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
		}
	}
}
 
Example 25
Source Project: MiningGadgets   Source File: UpgradeCard.java    License: MIT License 5 votes vote down vote up
@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));
    }

}
 
Example 26
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;
}
 
Example 27
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);
}
 
Example 28
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);
    }
}
 
Example 29
@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"));
	}
}
 
Example 30
@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);
}