當前位置: 首頁>>代碼示例>>Java>>正文


Java ChatStyle.setColor方法代碼示例

本文整理匯總了Java中net.minecraft.util.ChatStyle.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Java ChatStyle.setColor方法的具體用法?Java ChatStyle.setColor怎麽用?Java ChatStyle.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.ChatStyle的用法示例。


在下文中一共展示了ChatStyle.setColor方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: printHelp

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
public static void printHelp(final @Nonnull ICommandSender sender, final @Nonnull IModCommand command) {
	final ChatStyle header = new ChatStyle();
	header.setColor(EnumChatFormatting.BLUE);
	ChatBuilder.create("signpic.command."+command.getFullCommandString().replace(" ", ".")+".format").useTranslation().setStyle(header).setParams(command.getFullCommandString()).sendPlayer(sender);
	final ChatStyle body = new ChatStyle();
	body.setColor(EnumChatFormatting.GRAY);
	final List<String> aliases = command.getCommandAliases();
	if (aliases!=null)
		ChatBuilder.create("signpic.command.aliases").useTranslation().setStyle(body).setParams(aliases.toString().replace("[", "").replace("]", "")).sendPlayer(sender);
	ChatBuilder.create("signpic.command.permlevel").useTranslation().setStyle(body).setParams(Integer.valueOf(command.getRequiredPermissionLevel())).sendPlayer(sender);
	ChatBuilder.create("signpic.command."+command.getFullCommandString().replace(" ", ".")+".help").useTranslation().setStyle(body).sendPlayer(sender);
	if (!command.getChildren().isEmpty()) {
		ChatBuilder.create("signpic.command.list").useTranslation().sendPlayer(sender);
		final Iterator<SubCommand> arg3 = command.getChildren().iterator();
		while (arg3.hasNext()) {
			final SubCommand child = arg3.next();
			ChatBuilder.create("signpic.command."+child.getFullCommandString().replace(" ", ".")+".desc").useTranslation().setParams(child.getCommandName()).sendPlayer(sender);
		}
	}

}
 
開發者ID:Team-Fruit,項目名稱:SignPicture,代碼行數:22,代碼來源:CommandHelpers.java

示例2: getStatName

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
@Override
public IChatComponent getStatName() {
    IChatComponent text = this.name.createCopy();
    ChatStyle style = text.getChatStyle();
    style.setColor(color);

    // So the achievement doesn't have to be registered on the client.
    IChatComponent desc = new ChatComponentText("");
    desc.appendSibling(text.createCopy()).appendText("\n");
    IChatComponent type = new ChatComponentText("Achievement");
    type.getChatStyle().setItalic(true);
    desc.appendSibling(type).appendText("\n");
    desc.appendSibling(new ChatComponentText(this.getDescription()));
    HoverEvent hover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, desc);
    style.setChatHoverEvent(hover);

    return text;
}
 
開發者ID:killjoy1221,項目名稱:Achievement-Get,代碼行數:19,代碼來源:StatAchievement.java

示例3: drawCountDown

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
@Override
protected void drawCountDown(int secondsRemaining)
{
       ChatComponentText text = new ChatComponentText("" + secondsRemaining + "...");
       ChatStyle style = new ChatStyle();
       style.setBold(true);
       if (secondsRemaining <= 5)
           style.setColor(EnumChatFormatting.RED);

       text.setChatStyle(style);
       Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(text, 1);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:13,代碼來源:AgentQuitFromTimeUpImplementation.java

示例4: createChatLink

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
public static ChatComponentText createChatLink(String text, String url, boolean bold, boolean underline, boolean italic, EnumChatFormatting color) {
	ChatComponentText link = new ChatComponentText(text);
	ChatStyle style = link.getChatStyle();
	style.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
	style.setBold(Boolean.valueOf(bold));
	style.setUnderlined(Boolean.valueOf(underline));
	style.setItalic(Boolean.valueOf(italic));
	style.setColor(color);
	return link;
}
 
開發者ID:NPException,項目名稱:Dimensional-Pockets,代碼行數:11,代碼來源:Utils.java

示例5: applyModifier

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
/**
 * Applies modifier to the style
 * Returns whether or not the modifier was valid
 */
private boolean applyModifier(ChatStyle chatStyle, char modifier) {
    if (modifier >= '0' && modifier <= '9' || modifier >= 'a' && modifier <= 'f') {
        chatStyle.setColor(ColorUtils.colorMap.get(modifier));
        return true;
    }
    switch (modifier) {
        case 'k': chatStyle.setObfuscated(true); return true;
        case 'l': chatStyle.setBold(true); return true;
        case 'm': chatStyle.setStrikethrough(true); return true;
        case 'n': chatStyle.setUnderlined(true); return true;
        case 'o': chatStyle.setItalic(true); return true;
    }
    return false;
}
 
開發者ID:MyEssentials,項目名稱:MyEssentials-Core,代碼行數:19,代碼來源:ChatComponentFormatted.java

示例6: inheritFlat

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
/**
   * Merges the given child ChatStyle into the given parent preserving hierarchical inheritance.
   * 
   * @param parent	The parent to inherit style information
   * @param child		The child style who's properties will override those in the parent
   */
  public static void inheritFlat(ChatStyle parent, ChatStyle child) {
if ((parent.getBold() != child.getBold()) && child.getBold()) {
	parent.setBold(true);
}
if ((parent.getItalic() != child.getItalic()) && child.getItalic()) {
	parent.setItalic(true);
}
if ((parent.getStrikethrough() != child.getStrikethrough()) && child.getStrikethrough()) {
	parent.setStrikethrough(true);
}
if ((parent.getUnderlined() != child.getUnderlined()) && child.getUnderlined()) {
	parent.setUnderlined(true);
}
if ((parent.getObfuscated() != child.getObfuscated()) && child.getObfuscated()) {
	parent.setObfuscated(true);
}
      
      Object temp;
      if ((temp = child.getColor()) != null) {
      	parent.setColor((EnumChatFormatting)temp);
      }
      if ((temp = child.getChatClickEvent()) != null) {
      	parent.setChatClickEvent((ClickEvent)temp);
      }
      if ((temp = child.getChatHoverEvent()) != null) {
      	parent.setChatHoverEvent((HoverEvent)temp);
      }
      if ((temp = child.getInsertion()) != null) {
      	parent.setInsertion((String)temp);
      }
  }
 
開發者ID:warriordog,項目名稱:BlazeLoader,代碼行數:38,代碼來源:ApiChat.java

示例7: processCommand

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
@Override
public void processCommand(ICommandSender sender, String[] args) {
	if (args.length > 0) {
		switch (args[0]) {
			case OPTION_COLORBLIND:
				if (args.length > 1) {
					Reference.COLOR_BLIND_MODE = Boolean.parseBoolean(args[1]);
					sender.addChatMessage(new ChatComponentText(OPTION_COLORBLIND + " set to: " + Reference.COLOR_BLIND_MODE));
				} else {
					sender.addChatMessage(new ChatComponentText("Current value for " + OPTION_COLORBLIND + ": " + Reference.COLOR_BLIND_MODE));
				}
				return;
			case OPTION_FANCY:
				if (args.length > 1) {
					Reference.FORCE_FANCY_RENDERING = Integer.parseInt(args[1]);
					sender.addChatMessage(new ChatComponentText(OPTION_FANCY + " set to: " + Reference.FORCE_FANCY_RENDERING));
				} else {
					sender.addChatMessage(new ChatComponentText("Current value for " + OPTION_FANCY + ": " + Reference.FORCE_FANCY_RENDERING));
				}
				return;
			case OPTION_FIELD_SHADER:
				if (args.length > 1) {
					Reference.USE_SHADER_FOR_PARTICLE_FIELD = Boolean.parseBoolean(args[1]);
					sender.addChatMessage(new ChatComponentText(OPTION_FIELD_SHADER + " set to: " + Reference.USE_SHADER_FOR_PARTICLE_FIELD));
				} else {
					sender.addChatMessage(new ChatComponentText("Current value for " + OPTION_FIELD_SHADER + ": " + Reference.USE_SHADER_FOR_PARTICLE_FIELD));
				}
				return;
			case OPTION_PARTICLE_PLANES:
				if (args.length > 1) {
					try {
						int newValue = Integer.parseInt(args[1]);
						if (newValue >= 1 && newValue <= 50) {
							Reference.NUMBER_OF_PARTICLE_PLANES = newValue;
							sender.addChatMessage(new ChatComponentText(OPTION_PARTICLE_PLANES + " set to: " + Reference.NUMBER_OF_PARTICLE_PLANES));
							return;
						}
					} catch (NumberFormatException ignored) {
						// ignore
					}
					sender.addChatMessage(new ChatComponentText("Valid values for " + OPTION_PARTICLE_PLANES + " range from 1 to 50"));
				}
				sender.addChatMessage(new ChatComponentText("Current value for " + OPTION_PARTICLE_PLANES + ": " + Reference.NUMBER_OF_PARTICLE_PLANES));
				return;
			case OPTION_SAVE:
				ConfigHandler.save(Reference.MOD_ID);
				sender.addChatMessage(new ChatComponentText("Saved current graphics settings to DP config file."));
				return;
			case OPTION_HELP:
			default:
				// fall through to no args call
		}
	}
	sender.addChatMessage(new ChatComponentText(""));
	sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
	sender.addChatMessage(new ChatComponentText("Valid options: "));
	for (int i = 0; i < ALL_OPTIONS.size(); i++) {
		ChatComponentText option = new ChatComponentText("  " + ALL_OPTIONS.get(i));
		ChatStyle style = option.getChatStyle();
		style.setColor(EnumChatFormatting.GOLD);
		sender.addChatMessage(option);

		ChatComponentText desc = new ChatComponentText("    " + SHORT_DESCRIPTIONS.get(i));
		style = desc.getChatStyle();
		style.setItalic(Boolean.TRUE);
		style.setColor(EnumChatFormatting.GRAY);
		sender.addChatMessage(desc);
	}
}
 
開發者ID:NPException,項目名稱:Dimensional-Pockets,代碼行數:70,代碼來源:RenderTweakCommand.java


注:本文中的net.minecraft.util.ChatStyle.setColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。