本文整理汇总了Java中net.minecraft.event.ClickEvent类的典型用法代码示例。如果您正苦于以下问题:Java ClickEvent类的具体用法?Java ClickEvent怎么用?Java ClickEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClickEvent类属于net.minecraft.event包,在下文中一共展示了ClickEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_152892_c
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public void func_152892_c(ErrorCode p_152892_1_)
{
if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED)
{
IChatComponent ichatcomponent = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]);
ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers"));
ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true));
IChatComponent ichatcomponent1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {ichatcomponent});
ichatcomponent1.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1);
}
else
{
IChatComponent ichatcomponent2 = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)});
ichatcomponent2.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent2);
}
}
示例2: applyChatLines
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public void applyChatLines(final @Nonnull List<ChatLine> lines) {
if (!lines.equals(this.linescache)) {
this.pendentryids.clear();
int updateCounterCreated = -1;
int chatLineID = -1;
{
final Set<EntryId> addedentries = Sets.newHashSet();
for (final ChatLine line : lines) {
updateCounterCreated = line.getUpdatedCounter();
chatLineID = line.getChatLineID();
final IChatComponent cc = line.func_151461_a();
final List<ClickEvent> clinks = getLinksFromChat(cc);
for (final ClickEvent clink : clinks) {
final EntryId entryid = new EntryIdBuilder().setURI(clink.getValue()).build();
if (!addedentries.contains(entryid))
this.pendentryids.add(entryid);
addedentries.add(entryid);
}
}
}
this.updateCounterCreated = updateCounterCreated;
this.chatLineID = chatLineID;
}
this.linescache = lines;
}
示例3: processSubCommand
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
@Override
public void processSubCommand(final ICommandSender sender, final String[] args) {
if (CommandAuth.this.auther==null)
printAuthStart(sender);
else if (CommandAuth.this.auther.getState()!=TweetQuakeAuther.AuthState.START)
new ChatBuilder().setText("このコマンドは現在有効ではありません。").setStyle(new ChatStyle().setColor(EnumChatFormatting.RED)).sendPlayer(sender);
else {
try {
final ChatStyle style1 = new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, CommandAuth.this.auther.getAuthURL()));
new ChatBuilder().setText("クリックして認証URLを開く").setStyle(style1).sendPlayer(sender);
final ChatStyle style2 = new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/eewreciever auth pin <これを消して数字にしてください>"));
new ChatBuilder().setText("認証IDを手に入れたらクリックしてIDを入力").setStyle(style2).sendPlayer(sender);
} catch (final TwitterException e) {
Reference.logger.error(e.getMessage(), e);
CommandAuth.printRetry(sender, this);
}
}
}
示例4: onEvent
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{
if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote
&& !ClientProxy.versionChecker.isLatestVersion())
{
ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
ChatComponentText versionWarningChatComponent =
new ChatComponentText("Your EpicProportions Mod is not latest version! Click here to update.");
versionWarningChatComponent.setChatStyle(clickableChatStyle);
event.player.addChatMessage(versionWarningChatComponent);
ClientProxy.haveWarnedVersionOutOfDate = true;
}
}
示例5: onEvent
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{
if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote
&& !ClientProxy.versionChecker.isLatestVersion())
{
ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
ChatComponentText versionWarningChatComponent =
new ChatComponentText("�4�l" + "Your EpicProportions Mod is not latest version! Click here to update.");
versionWarningChatComponent.setChatStyle(clickableChatStyle);
event.player.addChatMessage(versionWarningChatComponent);
ClientProxy.haveWarnedVersionOutOfDate = true;
}
}
示例6: run
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public void run() {
if (!MCPVPVersion.updateAvailable()) return;
if (Main.mc.thePlayer != null && Main.mc.theWorld != null && ConfigVersion.updateNotifications) {
String msg = "";
// Send update message.
if (ConfigVersion.channel.equalsIgnoreCase("Main"))
msg = Format.s("update-msg").replace("<VERSION>", Main.mcpvpVersion.main.mod).replace("<MCVERSION>", Main.mcpvpVersion.main.mc);
else if (ConfigVersion.channel.equalsIgnoreCase("Beta"))
msg = Format.s("update-msg").replace("<VERSION>", Main.mcpvpVersion.beta.mod).replace("<MCVERSION>", Main.mcpvpVersion.beta.mc);
IChatComponent send = new ChatComponentText(Format.process(msg));
send.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, Format.s("update-url")));
Main.mc.thePlayer.addChatMessage(send);
}
}
示例7: onClientTick
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
if(event.phase == Phase.END) {
for(EQMod mod : EQMod.mods.values()) {
if(mod.config.displayVersionResult && !mod.versionMessage && mod.versionResult == EQVersion.OUTDATED) {
if(FMLClientHandler.instance().getClient().currentScreen == null) {
if(mod.versionResult != EQVersion.UNINITIALIZED || mod.versionResult != EQVersion.FINAL_ERROR) {
mod.versionMessage = true;
if(mod.versionResult == EQVersion.OUTDATED) {
ChatComponentText chatComponent = new ChatComponentText(EQVersion.getResultMessageForClient(mod));
chatComponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(LanguageManager.getLocalization("elconqore.version.chat_hover"))));
chatComponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, mod.remoteUpdateLocation));
Minecraft.getMinecraft().thePlayer.addChatMessage(chatComponent);
}
}
}
}
}
}
}
示例8: onPlayerConnect
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public void onPlayerConnect(ICommandSender sender)
{
if (checking) {
this.senders.add(sender);
} else {
int updates = UpdateCheckThreadController.instance.getUpdates();
if (updates > 0) {
String msg = "There "+(updates == 1 ? "is " : "are ")+EnumChatFormatting.RED+updates+EnumChatFormatting.AQUA+" mod"+(updates == 1 ? "" : "s")+" with"+(updates == 1 ? " a" : "")+" new version"+(updates == 1 ? "" : "s")+".";
sender.addChatMessage(new ChatComponentText(msg).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA)));
IChatComponent chatComponentBody = new ChatComponentText("For more information, please type ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA));
IChatComponent chatComponentLink = new ChatComponentText("/updates").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED).setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/updates")).setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("Run command").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)))));;
sender.addChatMessage(chatComponentBody.appendSibling(chatComponentLink));
}
}
}
示例9: func_152892_c
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public void func_152892_c(ErrorCode p_152892_1_)
{
ChatComponentTranslation chatcomponenttranslation;
if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED)
{
chatcomponenttranslation = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]);
chatcomponenttranslation.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers"));
chatcomponenttranslation.getChatStyle().setUnderlined(Boolean.valueOf(true));
ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {chatcomponenttranslation});
chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
this.field_152953_e.ingameGUI.getChatGUI().printChatMessage(chatcomponenttranslation1);
}
else
{
chatcomponenttranslation = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)});
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
this.field_152953_e.ingameGUI.getChatGUI().printChatMessage(chatcomponenttranslation);
}
}
示例10: getFormattedChatText
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public IChatComponent getFormattedChatText() {
String text = StatCollector.translateToLocal("neiLotr.versionChecker.notification.chat");
String[] parts = text.split("7");
String text1 = parts[0];
String text2 = parts[1];
String text3 = parts[2];
String text4 = parts[3];
ChatComponentText chat1 = (ChatComponentText) new ChatComponentText("[NEI LOTR]: ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN));
ChatComponentText chat2 = (ChatComponentText) new ChatComponentText(text1 + " ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
ChatComponentText chat3 = (ChatComponentText) new ChatComponentText(text2)
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE).setUnderlined(true)
.setChatClickEvent(
new ClickEvent(Action.OPEN_URL, "https://goo.gl/EkxFlC"))
.setChatHoverEvent(
new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT,
new ChatComponentText(StatCollector
.translateToLocal("neiLotr.versionChecker.notification.changelog")
.replace("/", "\n")))));
ChatComponentText chat4 = (ChatComponentText) new ChatComponentText(" " + text3 + " ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
ChatComponentText chat5 = (ChatComponentText) new ChatComponentText(state.toString() + " " + version)
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW).setUnderlined(true)
.setChatClickEvent(
new ClickEvent(Action.OPEN_URL, url))
.setChatHoverEvent(
new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT,
new ChatComponentText(StatCollector
.translateToLocal("neiLotr.versionChecker.notification.newVersion")
.replace("/", "\n")))));
ChatComponentText chat6 = (ChatComponentText) new ChatComponentText(" " + text4 + " ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
ChatComponentText chat7 = (ChatComponentText) new ChatComponentText(mcVersion)
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
return chat1.appendSibling(chat2).appendSibling(chat3).appendSibling(chat4).appendSibling(chat5)
.appendSibling(chat6).appendSibling(chat7);
}
示例11: mouseClicked
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
int info2Start = (this.height / 2) - 50;
if (orderPressed && !isSure && mouseY >= info2Start && mouseY <= info2Start + fontRendererObj.FONT_HEIGHT)
{
IChatComponent comp = getComponent(mouseX, mouseY);
ClickEvent clickevent = comp.getChatStyle().getChatClickEvent();
if (clickevent != null && clickevent.getAction() == ClickEvent.Action.OPEN_URL)
{
try
{
URI uri = new URI(clickevent.getValue());
Class<?> oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop").invoke(null);
oclass.getMethod("browse", URI.class).invoke(object, uri);
}
catch (Throwable t)
{
CreeperHost.logger.error("Can\'t open url for " + clickevent, t);
}
return;
}
}
for (TextFieldDetails field : this.fields)
{
field.mouseClicked(mouseX, mouseY, mouseButton);
}
}
示例12: getDisplayName
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
/**
* Get the formatted ChatComponent that will be used for the sender's username in chat
*/
public IChatComponent getDisplayName()
{
IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent());
ichatcomponent.getChatStyle().setInsertion(this.getName());
return ichatcomponent;
}
示例13: func_180605_a
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
public void func_180605_a(String p_180605_1_, ChatRawMessage[] p_180605_2_)
{
for (ChatRawMessage chatrawmessage : p_180605_2_)
{
this.func_176027_a(chatrawmessage.userName, chatrawmessage);
if (this.func_176028_a(chatrawmessage.modes, chatrawmessage.subscriptions, this.mc.gameSettings.streamChatUserFilter))
{
IChatComponent ichatcomponent = new ChatComponentText(chatrawmessage.userName);
IChatComponent ichatcomponent1 = new ChatComponentTranslation("chat.stream." + (chatrawmessage.action ? "emote" : "text"), new Object[] {this.twitchComponent, ichatcomponent, EnumChatFormatting.getTextWithoutFormattingCodes(chatrawmessage.message)});
if (chatrawmessage.action)
{
ichatcomponent1.getChatStyle().setItalic(Boolean.valueOf(true));
}
IChatComponent ichatcomponent2 = new ChatComponentText("");
ichatcomponent2.appendSibling(new ChatComponentTranslation("stream.userinfo.chatTooltip", new Object[0]));
for (IChatComponent ichatcomponent3 : GuiTwitchUserMode.func_152328_a(chatrawmessage.modes, chatrawmessage.subscriptions, (IStream)null))
{
ichatcomponent2.appendText("\n");
ichatcomponent2.appendSibling(ichatcomponent3);
}
ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ichatcomponent2));
ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.TWITCH_USER_INFO, chatrawmessage.userName));
this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1);
}
}
}
示例14: getLinksFromChat0
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
private static void getLinksFromChat0(final @Nonnull List<ClickEvent> list, final @Nonnull IChatComponent pchat) {
final List<?> chats = pchat.getSiblings();
for (final Object o : chats) {
final IChatComponent chat = (IChatComponent) o;
final ClickEvent ev = chat.getChatStyle().getChatClickEvent();
if (ev!=null&&ev.getAction()==ClickEvent.Action.OPEN_URL)
list.add(ev);
getLinksFromChat0(list, chat);
}
}
示例15: onPlayerJoinWorld
import net.minecraft.event.ClickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerJoinWorld(EntityJoinWorldEvent event) {
if (UsefulFunctions.isPlayer(event.entity) && event.world.isRemote) {
Version version = RorysMod.instance.versionCheker;
if (!version.haveWarnedVersionOutOfDate && !version.isLatestVersion()) {
ChatComponentText localChatComponentText = new ChatComponentText("");
ChatStyle localChatStyle;
IChatComponent modVersion = new ChatComponentText(EnumChatFormatting.AQUA + StatCollector.translateToLocal("message.rorysmod.version.current") + ": " + RorysGlobal.VERSION);
IChatComponent modName = new ChatComponentText(EnumChatFormatting.GOLD + "[" + RorysGlobal.NAME + "]" + EnumChatFormatting.WHITE);
localChatStyle = modName.getChatStyle();
localChatStyle.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, modVersion));
localChatStyle.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://rorysmod.rtfd.io"));
localChatComponentText.appendSibling(modName);
IChatComponent newVersion = new ChatComponentText(" " + StatCollector.translateToLocal("message.rorysmod.version.new"));
newVersion.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.WHITE + version.getLatest().getName())));
localChatComponentText.appendSibling(newVersion);
UsefulFunctions.getPlayerFromEntity(event.entity).addChatMessage(localChatComponentText);
localChatComponentText = new ChatComponentText("");
IChatComponent download = new ChatComponentText(EnumChatFormatting.GREEN + StatCollector.translateToLocal("message.rorysmod.download"));
download.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, version.getLatest().getHtmlUrl())).setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("message.rorysmod.version.download"))));
IChatComponent update = new ChatComponentText("[");
update.appendSibling(download);
update.appendText(EnumChatFormatting.WHITE + "] " + EnumChatFormatting.GRAY + version.getLatest().getName());
update.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, version.getLatest().getHtmlUrl()));
localChatComponentText.appendSibling(update);
UsefulFunctions.getPlayerFromEntity(event.entity).addChatMessage(localChatComponentText);
version.haveWarnedVersionOutOfDate = true;
}
}
}