Posted November 1, 20187 yr 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.
November 1, 20187 yr Author 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 November 1, 20187 yr by AntiRix
November 1, 20187 yr Author Yes, getAbsolutePath() works fine if I go to that file on my system. Opening it through the link in chat doesn't work though, so it's not the issue that the path is incorrect.
November 1, 20187 yr Author My system is perfectly fine. Everything's set up as default. Brand new computer and no issues whatsoever with anything.
November 1, 20187 yr Author 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
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.