本文整理匯總了Java中net.minecraft.util.ChatStyle.setBold方法的典型用法代碼示例。如果您正苦於以下問題:Java ChatStyle.setBold方法的具體用法?Java ChatStyle.setBold怎麽用?Java ChatStyle.setBold使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.ChatStyle
的用法示例。
在下文中一共展示了ChatStyle.setBold方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: getParsedText
import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
private ChatComponentText getParsedText(String text)
{
ChatComponentText output = new ChatComponentText("");
ChatStyle style = new ChatStyle();
String[] splitted = text.split(" ");
String temp = "";
style.setBold(true);
style.setUnderlined(true);
for (String s : splitted)
{
if (s.startsWith("http"))
{
output.appendText(temp);
temp = "";
style.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, s));
output.appendSibling(new ChatComponentText(s).setChatStyle(style));
output.appendText(" ");
}
else
{
temp += s + " ";
}
}
output.appendText(temp);
return output;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
}