Jump to content

Error in console when using ClickEvent.Action.OPEN_FILE


AntiRix

Recommended Posts

Hi,

 

My code is as follows; when clicking the message in chat, I get the message below the code block. I've tried several methods on the File and can't get it to open it. Any ideas what might be causing this?

 

@SubscribeEvent
public void onScreenshot(ScreenshotEvent event)
{
	event.setResultMessage(new TextComponentString(""));
	
	ITextComponent text = new TextComponentString("\u00a7a[ClientImprovements] Screenshot taken!");
	Style style = new Style();

	style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("\u00a7aOpen " + event.getScreenshotFile().getName())));
	style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, event.getScreenshotFile().getAbsolutePath()));
	text.setStyle(style);
		
	mc.player.sendMessage(new TextComponentString(""));
	mc.player.sendMessage(text);
}

 

[21:00:10] [main/ERROR] [minecraft/GuiScreen]: Couldn't open link: Failed to open file:/C:/Users/xxx/AppData/Roaming/.minecraft/screenshots/2018-11-01_21.00.08.png. Error message: A device attached to the system is not functioning.

Link to comment
Share on other sites

I'm just in the habit of using those codes because usually I just use one-liners such as mc.player.sendMessage(new TextComponentString("...")); and don't declare the style

 

When I click the link in chat, the file exists because I can go to that path and open the file normally, but not through minecraft.

Edited by AntiRix
Link to comment
Share on other sites

Very strange issue indeed - found a workaround. There's an issue opening files if mspaint is associated with .png files. Changing it to Photos works, but like all modern Windows apps, it's horribly slow.

 

https://bugs.mojang.com/browse/MC-31787?focusedCommentId=106111&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-106111

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.