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


Java ChatStyle.getChatClickEvent方法代碼示例

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


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

示例1: 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

示例2: executeCommand

import net.minecraft.util.ChatStyle; //導入方法依賴的package包/類
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public IChatComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(IChatComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3 getPositionVector()
        {
            return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            TileEntitySign.this.stats.func_179672_a(this, type, amount);
        }
    };

    for (int i = 0; i < this.signText.length; ++i)
    {
        ChatStyle chatstyle = this.signText[i] == null ? null : this.signText[i].getChatStyle();

        if (chatstyle != null && chatstyle.getChatClickEvent() != null)
        {
            ClickEvent clickevent = chatstyle.getChatClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                MinecraftServer.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:63,代碼來源:TileEntitySign.java


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