Search in sources :

Example 36 with Style

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

the class RecipeMapMultiblockController method addDisplayText.

@Override
protected void addDisplayText(List<ITextComponent> textList) {
    super.addDisplayText(textList);
    if (isStructureFormed()) {
        IEnergyContainer energyContainer = recipeMapWorkable.getEnergyContainer();
        if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) {
            long maxVoltage = energyContainer.getInputVoltage();
            String voltageName = GTValues.VN[GTUtility.getTierByVoltage(maxVoltage)];
            textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, voltageName));
        }
        if (!recipeMapWorkable.isWorkingEnabled()) {
            textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused"));
        } else if (recipeMapWorkable.isActive()) {
            textList.add(new TextComponentTranslation("gregtech.multiblock.running"));
            int currentProgress = (int) (recipeMapWorkable.getProgressPercent() * 100);
            textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress));
        } else {
            textList.add(new TextComponentTranslation("gregtech.multiblock.idling"));
        }
        if (recipeMapWorkable.isHasNotEnoughEnergy()) {
            textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy").setStyle(new Style().setColor(TextFormatting.RED)));
        }
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) IEnergyContainer(gregtech.api.capability.IEnergyContainer) Style(net.minecraft.util.text.Style)

Example 37 with Style

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

the class MultiblockWithDisplayBase method addDisplayText.

/**
 * Called serverside to obtain text displayed in GUI
 * each element of list is displayed on new line
 * to use translation, use TextComponentTranslation
 */
protected void addDisplayText(List<ITextComponent> textList) {
    if (!isStructureFormed()) {
        ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.invalid_structure.tooltip");
        tooltip.setStyle(new Style().setColor(TextFormatting.GRAY));
        textList.add(new TextComponentTranslation("gregtech.multiblock.invalid_structure").setStyle(new Style().setColor(TextFormatting.RED).setHoverEvent(new HoverEvent(Action.SHOW_TEXT, tooltip))));
    }
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ITextComponent(net.minecraft.util.text.ITextComponent) Style(net.minecraft.util.text.Style)

Example 38 with Style

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

the class CommandWorldgenReload method execute.

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
    try {
        WorldGenRegistry.INSTANCE.reinitializeRegisteredVeins();
        sender.sendMessage(new TextComponentTranslation("gregtech.command.worldgen.reload.success").setStyle(new Style().setColor(TextFormatting.GREEN)));
    } catch (IOException | RuntimeException exception) {
        GTLog.logger.error("Failed to reload worldgen config", exception);
        sender.sendMessage(new TextComponentTranslation("gregtech.command.worldgen.reload.failed").setStyle(new Style().setColor(TextFormatting.RED)));
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) Style(net.minecraft.util.text.Style) IOException(java.io.IOException)

Example 39 with Style

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

the class ElectricBlastFurnaceInfo method generateBlockTooltips.

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

Example 40 with Style

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

the class MultiSmelterInfo method generateBlockTooltips.

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

Aggregations

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