net.minecraft.util.text.TextFormatting Java Examples

The following examples show how to use net.minecraft.util.text.TextFormatting. 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 check out the related API usage on the sidebar.
Example #1
Source File: DanmakuThreadFactory.java    From BakaDanmaku with 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 #2
Source File: GuiButtonInputBinding.java    From Better-Sprinting with Mozilla Public License 2.0 6 votes vote down vote up
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 #3
Source File: Freecam.java    From bleachhack-1.14 with 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 #4
Source File: NEIServerUtils.java    From NotEnoughItems with 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 #5
Source File: ItemPickupManager.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #6
Source File: FluidCowEntityProvider.java    From Moo-Fluids with GNU General Public License v3.0 6 votes vote down vote up
@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 #7
Source File: BaseEntryList.java    From WearableBackpacks with 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 #8
Source File: GuiCustomizeWorld.java    From YUNoMakeGoodMap with 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 #9
Source File: MultiblockInfoRecipeWrapper.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #10
Source File: ItemVoidPickaxe.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #11
Source File: MetaTileEntityLargeTurbine.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #12
Source File: BlockSurfaceRockNew.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #13
Source File: ItemPotteryVessel.java    From TFC2 with 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 #14
Source File: ItemTicket.java    From Signals with 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 #15
Source File: GTCommandTeleport.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #16
Source File: BlockSieve.java    From ExNihiloAdscensio with 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 #17
Source File: BlockGyroscopeDampener.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, @Nullable World player,
    List<String> itemInformation,
    ITooltipFlag advanced) {
    itemInformation
        .add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.gyroscope_dampener"));
}
 
Example #18
Source File: ItemMobHarness.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String getItemStackDisplayName(ItemStack stack)
{
    if (stack.getTagCompound() == null || this.hasTarget(stack) == false)
    {
        return super.getItemStackDisplayName(stack);
    }

    String target = stack.getTagCompound().getString("TargetName");
    return super.getItemStackDisplayName(stack) + " " + TextFormatting.GREEN + target + TextFormatting.RESET + TextFormatting.WHITE;
}
 
Example #19
Source File: ItemPotteryMold.java    From TFC2 with GNU General Public License v3.0 5 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.getItemDamage() < 2)
	{
		String[] name = new String[] {"global.clay", "global.ceramic"};
		arraylist.add(TextFormatting.DARK_GRAY + Core.translate(name[is.getItemDamage()]));
	}
	else
		arraylist.add(TextFormatting.DARK_GRAY + Core.translate(this.subTypeNames[is.getItemDamage()]));
}
 
Example #20
Source File: ItemWrench.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, @Nullable World player,
    List<String> itemInformation,
    ITooltipFlag advanced) {
    if (VSConfig.wrenchModeless) {
        itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.wrench_toggle"));
    } else {
        itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.wrench." + this.mode.toString()));
        itemInformation.add(TextFormatting.GREEN + "" + TextFormatting.ITALIC + I18n.format("tooltip.vs_control.wrench_modes"));
    }
}
 
Example #21
Source File: BlockGiantPropellerPart.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, @Nullable World player,
    List<String> itemInformation,
    ITooltipFlag advanced) {
    itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.giant_propeller_part"));
            itemInformation.add(TextFormatting.BLUE + "" + TextFormatting.ITALIC + I18n.format("tooltip.vs_control.wrench_usage"));
}
 
Example #22
Source File: BlockValkyriumCompressorPart.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, @Nullable World player,
    List<String> itemInformation,
    ITooltipFlag advanced) {
    itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.valkyrium_compressor_part_1"));
    itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.valkyrium_compressor_part_2"));
    itemInformation.add(TextFormatting.BLUE + "" + TextFormatting.ITALIC + I18n.format("tooltip.vs_control.wrench_usage"));
}
 
Example #23
Source File: MiscUtils.java    From OpenModsLib with MIT License 5 votes vote down vote up
public static String getTranslatedFluidName(FluidStack fluidStack) {
	if (fluidStack == null) return "";
	final Fluid fluid = fluidStack.getFluid();
	String localizedName = fluid.getLocalizedName(fluidStack);
	if (!Strings.isNullOrEmpty(localizedName) && !localizedName.equals(fluid.getUnlocalizedName())) {
		return fluid.getRarity(fluidStack).rarityColor.toString() + localizedName;
	} else {
		return TextFormatting.OBFUSCATED + "LOLNOPE" + TextFormatting.RESET;
	}
}
 
Example #24
Source File: CommandFindBiome.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	Biome biome = null;
	if (args.length == 0) {
		sender.sendMessage(new TextComponentString("No biome specified"));
		return;
	}
	for (Biome b : ForgeRegistries.BIOMES.getValues()) {
		String name = b.getRegistryName().toString().replaceAll(" ", "_").toLowerCase();
		if (args[0].equalsIgnoreCase(name)) {
			biome = b;
		}
	}
	if (biome == null) {
		sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! Biome '" + args[0] + "' cannot be found!"));
		return;
	}
	long start = System.currentTimeMillis();
	final Biome finalBiome = biome;
	new Thread(() -> {
		BlockPos pos = spiralOutwardsLookingForBiome(sender, sender.getEntityWorld(), finalBiome, sender.getPosition().getX(), sender.getPosition().getZ(), TraverseConfig.findBiomeCommandTimeout);
		if (pos == null) {
			server.addScheduledTask(() -> sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! Biome '" + args[0] + "' could not be found after " + TextFormatting.GRAY + TraverseConfig.findBiomeCommandTimeout + "ms" + TextFormatting.RED + ".")));
			return;
		}
		if (sender instanceof EntityPlayerMP) {
			server.addScheduledTask(() -> {
				EntityPlayerMP playerMP = (EntityPlayerMP) sender;
				playerMP.connection.setPlayerLocation(pos.getX(), 150, pos.getZ(), 0, 0);
				sender.sendMessage(new TextComponentString(TextFormatting.WHITE + "Found '" + finalBiome.getRegistryName().toString() + "' Biome! " + TextFormatting.GRAY + "(" + (System.currentTimeMillis() - start) + "ms)"));
			});
			return;
		}
		server.addScheduledTask(() -> sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! An unknown error occurred.")));
	}, "Biome Finder - Traverse").start();
}
 
Example #25
Source File: BlockGearbox.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, @Nullable World player,
    List<String> itemInformation,
    ITooltipFlag advanced) {
    itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.gearbox_1"));
    itemInformation.add(TextFormatting.BLUE + I18n.format("tooltip.vs_control.gearbox_2"));
}
 
Example #26
Source File: ItemTofuForceSword.java    From TofuCraftReload with 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 #27
Source File: TestRunner.java    From NoCubes with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @return if the test FAILED
 */
private static boolean runTestWithCatch(final Test test, final MinecraftServer server) {
	try {
		test.action.run();
	} catch (Exception e) {
		log(server, new StringTextComponent("TEST FAILED: " + test.name).applyTextStyle(TextFormatting.RED));
		e.printStackTrace();
		return true;
	}
	return false;
}
 
Example #28
Source File: VanillaCommandWrapper.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
    if (!testPermission(sender)) return true;

    ICommandSender icommandlistener = getListener(sender);
    try {
        dispatchVanillaCommand(sender, icommandlistener, args);
    } catch (CommandException commandexception) {
        // Taken from CommandHandler
        TextComponentTranslation chatmessage = new TextComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
        chatmessage.getStyle().setColor(TextFormatting.RED);
        icommandlistener.sendMessage(chatmessage);
    }
    return true;
}
 
Example #29
Source File: GTBlockUUMAssembler.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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(count)) {
			tooltip.add(TextFormatting.AQUA + I18n.format(nbt.getInteger(count) + " of UU-Matter stored"));
		}
		if (nbt.hasKey("energy")) {
			tooltip.add(TextFormatting.AQUA + I18n.format(nbt.getInteger("energy") + " EU stored"));
		}
	}
	super.addInformation(stack, worldIn, tooltip, flagIn);
}
 
Example #30
Source File: ServerQuitFromTimeUpImplementation.java    From malmo with MIT License 5 votes vote down vote up
@Override
protected void drawCountDown(int secondsRemaining)
{
	Map<String, String> data = new HashMap<String, String>();
	
       String text = TextFormatting.BOLD + "" + secondsRemaining + "...";
       if (secondsRemaining <= 5)
           text = TextFormatting.RED + text;

	data.put("chat", text);
	MalmoMod.safeSendToAll(MalmoMessageType.SERVER_TEXT, data);
}