Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

  • 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 by AntiRix

  • 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.

  • Author

My system is perfectly fine. Everything's set up as default. Brand new computer and no issues whatsoever with anything.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.