Package net.minecraftforge.client.event
Class ScreenshotEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.ScreenshotEvent
public class ScreenshotEvent
extends net.minecraftforge.eventbus.api.Event
Fired when a screenshot is taken, but before it is written to disk.
This event is cancellable, and does not have a result. 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.
This event is fired on the main Forge event bus, only on the logical client.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Component
private final NativeImage
private 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.Returns the custom cancellation message, ornull
if no custom message is set.void
setResultMessage
(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 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
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
-