Class DrawingContext
java.lang.Object
xyz.gmitch215.socketmc.util.render.DrawingContext
- All Implemented Interfaces:
- Serializable,- Cloneable,- Iterable<Function<GraphicsContext,- DrawingContext.Command>> 
public final class DrawingContext
extends Object
implements Serializable, Iterable<Function<GraphicsContext,DrawingContext.Command>>, Cloneable 
Represents the raw graphics context used to display graphics on the screen.
This allows you to also collect the context of the current screen, as specified in GraphicsContext.
 The Function interfaces you specify must be serializable and cannot call anything external.
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classRepresents a command in a DrawingContext.static final classRepresents a modifier for a specificDrawingContext.Command.static enumRepresents the type of drawing command to use.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intBlitstatic final intBlit Spritestatic final intDisable Scissorstatic final intDraw Centered Stringstatic final intDraw ItemStackstatic final intDraw Stringstatic final intDraw Tooltipstatic final intDraw Word Wrapstatic final intEnable Scissorstatic final intFillstatic final intFill Gradientstatic final intHorizontal Linestatic final intA custom modifier on the normal for the pose stack.static final intA custom modifier on the pose for the pose stack.static final intRotates an element on the XYZ axis.static final intRotates an element on the XYZ axis around a specific coordinate.static final intScales an element on the XYZ axis.static final intTranslates an element across the XYZ axis.static final intOutlinestatic final intVertical Line
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCommand(int index, @NotNull Function<GraphicsContext, DrawingContext.Command> command) Adds a command to the DrawingContext at the specified index.voidaddCommand(int index, @NotNull DrawingContext.Command command) Adds a command to the DrawingContext at the specified index.voidAdds a command to the DrawingContext.voidaddCommand(@NotNull DrawingContext.Command command) Adds a command to the DrawingContext.voidClears all commands from the DrawingContext.clone()booleanGets an immutable copy of the commands in this DrawingContext, with the currentGraphicsContextinformation.inthashCode()booleanisLocked()Checks if the DrawingContext is locked.iterator()voidlock()Locks the DrawingContext, making it immutable.static @NotNull DrawingContextof(@NotNull Collection<Function<GraphicsContext, DrawingContext.Command>> commands) Creates a newDrawingContextfrom a list of commands.static @NotNull DrawingContextof(@NotNull Function<GraphicsContext, DrawingContext.Command> command) Creates a newDrawingContextfrom a single command.static @NotNull DrawingContextof(@NotNull Function<GraphicsContext, DrawingContext.Command>... commands) Creates a newDrawingContextfrom an array of commands.voidremoveCommand(int index) Removes a command from the DrawingContext at the specified index.toString()Methods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
H_LINEpublic static final int H_LINEHorizontal Line- See Also:
 
- 
V_LINEpublic static final int V_LINEVertical Line- See Also:
 
- 
ENABLE_SCISSORpublic static final int ENABLE_SCISSOREnable Scissor- See Also:
 
- 
DISABLE_SCISSORpublic static final int DISABLE_SCISSORDisable Scissor- See Also:
 
- 
FILLpublic static final int FILLFill- See Also:
 
- 
FILL_GRADIENTpublic static final int FILL_GRADIENTFill Gradient- See Also:
 
- 
DRAW_CENTERED_STRINGpublic static final int DRAW_CENTERED_STRINGDraw Centered String- See Also:
 
- 
DRAW_STRINGpublic static final int DRAW_STRINGDraw String- See Also:
 
- 
DRAW_WORD_WRAPpublic static final int DRAW_WORD_WRAPDraw Word Wrap- See Also:
 
- 
OUTLINEpublic static final int OUTLINEOutline- See Also:
 
- 
BLITpublic static final int BLITBlit- See Also:
 
- 
BLIT_SPRITEpublic static final int BLIT_SPRITEBlit Sprite- See Also:
 
- 
DRAW_TOOLTIPpublic static final int DRAW_TOOLTIPDraw Tooltip- See Also:
 
- 
DRAW_ITEMSTACKpublic static final int DRAW_ITEMSTACKDraw ItemStack- See Also:
 
- 
MODIFIER_SCALEpublic static final int MODIFIER_SCALEScales an element on the XYZ axis.- See Also:
 
- 
MODIFIER_TRANSLATEpublic static final int MODIFIER_TRANSLATETranslates an element across the XYZ axis.- See Also:
 
- 
MODIFIER_ROTATEpublic static final int MODIFIER_ROTATERotates an element on the XYZ axis.- See Also:
 
- 
MODIFIER_ROTATE_AROUNDpublic static final int MODIFIER_ROTATE_AROUNDRotates an element on the XYZ axis around a specific coordinate.- See Also:
 
- 
MODIFIER_APPLY_POSEpublic static final int MODIFIER_APPLY_POSEA custom modifier on the pose for the pose stack.- See Also:
 
- 
MODIFIER_APPLY_NORMALpublic static final int MODIFIER_APPLY_NORMALA custom modifier on the normal for the pose stack.- See Also:
 
 
- 
- 
Method Details- 
getCommandsGets an immutable copy of the commands in this DrawingContext, with the currentGraphicsContextinformation.- Returns:
- DrawingContext Commands
 
- 
addCommandpublic void addCommand(@NotNull @NotNull DrawingContext.Command command) throws IllegalArgumentException Adds a command to the DrawingContext.- Parameters:
- command- the command to add
- Throws:
- IllegalArgumentException- if the command is null
 
- 
addCommandpublic void addCommand(@NotNull @NotNull Function<GraphicsContext, DrawingContext.Command> command) throws IllegalArgumentExceptionAdds a command to the DrawingContext.- Parameters:
- command- the command to add
- Throws:
- IllegalArgumentException- if the command is null
 
- 
addCommandpublic void addCommand(int index, @NotNull @NotNull DrawingContext.Command command) throws IllegalArgumentException Adds a command to the DrawingContext at the specified index.- Parameters:
- index- the index to add the command at
- command- the command to add
- Throws:
- IllegalArgumentException- if the command is null
 
- 
addCommandpublic void addCommand(int index, @NotNull @NotNull Function<GraphicsContext, DrawingContext.Command> command) throws IllegalArgumentExceptionAdds a command to the DrawingContext at the specified index.- Parameters:
- index- the index to add the command at
- command- the command to add
- Throws:
- IllegalArgumentException- if the command is null
 
- 
removeCommandpublic void removeCommand(int index) Removes a command from the DrawingContext at the specified index.- Parameters:
- index- the index to remove the command at
 
- 
clearCommandspublic void clearCommands()Clears all commands from the DrawingContext.
- 
isLockedpublic boolean isLocked()Checks if the DrawingContext is locked. If true, this DrawingContext cannot be modified.- Returns:
- true if the DrawingContext is locked, false otherwise
 
- 
lockLocks the DrawingContext, making it immutable.- Throws:
- IllegalStateException- if the DrawingContext is already locked
 
- 
clone
- 
iterator- Specified by:
- iteratorin interface- Iterable<Function<GraphicsContext,- DrawingContext.Command>> 
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
of@NotNull public static @NotNull DrawingContext of(@NotNull @NotNull Function<GraphicsContext, DrawingContext.Command> command) throws IllegalArgumentExceptionCreates a newDrawingContextfrom a single command.- Parameters:
- command- the command to use
- Returns:
- A new DrawingContext
- Throws:
- IllegalArgumentException- if the command is null
 
- 
of@NotNull public static @NotNull DrawingContext of(@NotNull @NotNull Collection<Function<GraphicsContext, DrawingContext.Command>> commands) throws IllegalArgumentExceptionCreates a newDrawingContextfrom a list of commands.- Parameters:
- commands- the commands to use
- Returns:
- A new DrawingContext
- Throws:
- IllegalArgumentException- if the commands are null
 
- 
of@NotNull @SafeVarargs public static @NotNull DrawingContext of(@NotNull @NotNull Function<GraphicsContext, DrawingContext.Command>... commands) throws IllegalArgumentExceptionCreates a newDrawingContextfrom an array of commands.- Parameters:
- commands- the commands to use
- Returns:
- A new DrawingContext
- Throws:
- IllegalArgumentException- if the commands are null
 
 
-