Class ScreenshotEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.ScreenshotEvent
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
public class ScreenshotEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.bus.api.ICancellableEvent
Fired when a screenshot is taken, but before it is written to disk.
This event is cancellable, and does not
.
If this event is cancelled, then the screenshot is not written to disk, and the message in the event will be posted
to the player's chat.invalid reference
have a result
This event is fired on the main Forge event bus, only on the logical client.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Component
private final NativeImage
private @Nullable Component
private File
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the cancellation message to be used in informing the player.getImage()
Returns the in-memory image of the screenshot.@Nullable Component
Returns the custom cancellation message, ornull
if no custom message is set.void
setResultMessage
(@Nullable Component resultMessage) Sets the new custom cancellation message used to inform the player.void
setScreenshotFile
(File screenshotFile) Sets the new file where the screenshot will be saved to.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
DEFAULT_CANCEL_REASON
-
image
-
screenshotFile
-
resultMessage
-
-
Constructor Details
-
ScreenshotEvent
-
-
Method Details
-
getImage
Returns the in-memory image of the screenshot.- Returns:
- the in-memory image of the screenshot
-
getScreenshotFile
- Returns:
- the file where the screenshot will be saved to
-
setScreenshotFile
Sets the new file where the screenshot will be saved to.- Parameters:
screenshotFile
- the new filepath
-
getResultMessage
Returns the custom cancellation message, ornull
if no custom message is set.- Returns:
- the custom cancellation message, or
null
if no custom message is set
-
setResultMessage
Sets the new custom cancellation message used to inform the player. It may benull
, in which case the default cancel reason will be used.- Parameters:
resultMessage
- the new result message
-
getCancelMessage
Returns the cancellation message to be used in informing the player.If there is no custom message given (
getResultMessage()
returnsnull
), then the message will be the default cancel reason message.- Returns:
- the cancel message for the player
-