public class GuiUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static ItemStack |
cachedTooltipStack |
static int[] |
colorCodes |
static int |
DEFAULT_BACKGROUND_COLOR |
static int |
DEFAULT_BORDER_COLOR_END |
static int |
DEFAULT_BORDER_COLOR_START |
static java.lang.String |
INVALID |
static java.lang.String |
RESET_CHAR |
static java.lang.String |
UNDO_CHAR |
static java.lang.String |
VALID |
Constructor and Description |
---|
GuiUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
drawContinuousTexturedBox(int x,
int y,
int u,
int v,
int width,
int height,
int textureWidth,
int textureHeight,
int borderSize,
float zLevel)
Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
and filler.
|
static void |
drawContinuousTexturedBox(int x,
int y,
int u,
int v,
int width,
int height,
int textureWidth,
int textureHeight,
int topBorder,
int bottomBorder,
int leftBorder,
int rightBorder,
float zLevel)
Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
and filler.
|
static void |
drawContinuousTexturedBox(ResourceLocation res,
int x,
int y,
int u,
int v,
int width,
int height,
int textureWidth,
int textureHeight,
int borderSize,
float zLevel)
Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
and filler.
|
static void |
drawContinuousTexturedBox(ResourceLocation res,
int x,
int y,
int u,
int v,
int width,
int height,
int textureWidth,
int textureHeight,
int topBorder,
int bottomBorder,
int leftBorder,
int rightBorder,
float zLevel)
Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
and filler.
|
static void |
drawGradientRect(int zLevel,
int left,
int top,
int right,
int bottom,
int startColor,
int endColor) |
static void |
drawHoveringText(ItemStack stack,
java.util.List<java.lang.String> textLines,
int mouseX,
int mouseY,
int screenWidth,
int screenHeight,
int maxTextWidth,
FontRenderer font) |
static void |
drawHoveringText(ItemStack stack,
java.util.List<java.lang.String> textLines,
int mouseX,
int mouseY,
int screenWidth,
int screenHeight,
int maxTextWidth,
int backgroundColor,
int borderColorStart,
int borderColorEnd,
FontRenderer font)
Use this version if calling from somewhere where ItemStack context is available.
|
static void |
drawHoveringText(java.util.List<java.lang.String> textLines,
int mouseX,
int mouseY,
int screenWidth,
int screenHeight,
int maxTextWidth,
FontRenderer font) |
static void |
drawHoveringText(java.util.List<java.lang.String> textLines,
int mouseX,
int mouseY,
int screenWidth,
int screenHeight,
int maxTextWidth,
int backgroundColor,
int borderColorStart,
int borderColorEnd,
FontRenderer font)
Draws a tooltip box on the screen with text in it.
|
static void |
drawInscribedRect(int x,
int y,
int boundsWidth,
int boundsHeight,
int rectWidth,
int rectHeight) |
static void |
drawInscribedRect(int x,
int y,
int boundsWidth,
int boundsHeight,
int rectWidth,
int rectHeight,
boolean centerX,
boolean centerY) |
static void |
drawTexturedModalRect(int x,
int y,
int u,
int v,
int width,
int height,
float zLevel) |
static int |
getColorCode(char c,
boolean isLighter) |
static void |
postItemToolTip()
Must be called from
GuiScreen.renderToolTip after GuiScreen.drawHoveringText is called. |
static void |
preItemToolTip(ItemStack stack)
Must be called from
GuiScreen.renderToolTip before GuiScreen.drawHoveringText is called. |
public static final int DEFAULT_BACKGROUND_COLOR
public static final int DEFAULT_BORDER_COLOR_START
public static final int DEFAULT_BORDER_COLOR_END
public static final java.lang.String UNDO_CHAR
public static final java.lang.String RESET_CHAR
public static final java.lang.String VALID
public static final java.lang.String INVALID
public static int[] colorCodes
@Nonnull private static ItemStack cachedTooltipStack
public static int getColorCode(char c, boolean isLighter)
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int borderSize, float zLevel)
x
- x axis offsety
- y axis offsetu
- bound resource location image x offsetv
- bound resource location image y offsetwidth
- the desired box widthheight
- the desired box heighttextureWidth
- the width of the box texture in the resource location imagetextureHeight
- the height of the box texture in the resource location imageborderSize
- the size of the box's borderszLevel
- the zLevel to draw atpublic static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int borderSize, float zLevel)
res
- the ResourceLocation object that contains the desired imagex
- x axis offsety
- y axis offsetu
- bound resource location image x offsetv
- bound resource location image y offsetwidth
- the desired box widthheight
- the desired box heighttextureWidth
- the width of the box texture in the resource location imagetextureHeight
- the height of the box texture in the resource location imageborderSize
- the size of the box's borderszLevel
- the zLevel to draw atpublic static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
res
- the ResourceLocation object that contains the desired imagex
- x axis offsety
- y axis offsetu
- bound resource location image x offsetv
- bound resource location image y offsetwidth
- the desired box widthheight
- the desired box heighttextureWidth
- the width of the box texture in the resource location imagetextureHeight
- the height of the box texture in the resource location imagetopBorder
- the size of the box's top borderbottomBorder
- the size of the box's bottom borderleftBorder
- the size of the box's left borderrightBorder
- the size of the box's right borderzLevel
- the zLevel to draw atpublic static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
x
- x axis offsety
- y axis offsetu
- bound resource location image x offsetv
- bound resource location image y offsetwidth
- the desired box widthheight
- the desired box heighttextureWidth
- the width of the box texture in the resource location imagetextureHeight
- the height of the box texture in the resource location imagetopBorder
- the size of the box's top borderbottomBorder
- the size of the box's bottom borderleftBorder
- the size of the box's left borderrightBorder
- the size of the box's right borderzLevel
- the zLevel to draw atpublic static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
public static void preItemToolTip(@Nonnull ItemStack stack)
GuiScreen.renderToolTip
before GuiScreen.drawHoveringText
is called.stack
- The stack for which a tooltip is about to be drawn.public static void postItemToolTip()
GuiScreen.renderToolTip
after GuiScreen.drawHoveringText
is called.public static void drawHoveringText(java.util.List<java.lang.String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
public static void drawHoveringText(java.util.List<java.lang.String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font)
textLines
- the lines of text to be drawn in a hovering tooltip box.mouseX
- the mouse X positionmouseY
- the mouse Y positionscreenWidth
- the available screen width for the tooltip to drawn inscreenHeight
- the available screen height for the tooltip to drawn inmaxTextWidth
- the maximum width of the text in the tooltip box.
Set to a negative number to have no max width.backgroundColor
- The background color of the boxborderColorStart
- The starting color of the box borderborderColorEnd
- The ending color of the box border. The border color will be smoothly interpolated
between the start and end values.font
- the font for drawing the text in the tooltip boxpublic static void drawHoveringText(@Nonnull ItemStack stack, java.util.List<java.lang.String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
public static void drawHoveringText(@Nonnull ItemStack stack, java.util.List<java.lang.String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font)
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor)
public static void drawInscribedRect(int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight)
public static void drawInscribedRect(int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY)