public class GuiRenderer extends MalisisRenderer
MalisisGui
.Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.Character,net.minecraft.util.EnumChatFormatting> |
charFormats
Map of EnumChatFormatting
|
UIComponent |
currentComponent
Current component being drawn.
|
static int |
FONT_HEIGHT
Font height.
|
static net.minecraft.client.renderer.entity.RenderItem |
itemRenderer
RenderItem used to draw itemStacks.
|
int |
mouseX
Current X position of the mouse.
|
int |
mouseY
Current Y position of the mouse.
|
baseBrightness, block, blockMetadata, damagedIcons, destroyBlockProgress, drawMode, face, getBlockDamage, isShifted, itemRenderType, itemStack, overrideTexture, params, partialTick, renderBlocks, renderGlobal, renderId, renderType, rp, shape, t, tileEntity, vertexDrawn, world, x, y, z
Constructor and Description |
---|
GuiRenderer()
Instantiates a new
GuiRenderer . |
Modifier and Type | Method and Description |
---|---|
void |
applyTexture(Shape shape,
RenderParameters parameters)
Applies the texture the
Shape . |
void |
bindDefaultTexture()
Reset the texture to its
defaultGuiTexture . |
void |
bindTexture(GuiTexture texture)
Bind a new texture for rendering.
|
void |
clean()
Cleans the current renderer state.
|
static java.lang.String |
clipString(java.lang.String text,
int width)
Clips a string to fit in the specified width.
|
static java.lang.String |
clipString(java.lang.String text,
int width,
float fontScale)
Clips a string to fit in the specified width with the fontScale.
|
static java.lang.String |
clipString(java.lang.String text,
int width,
float fontScale,
boolean appendPeriods) |
void |
drawItemStack(net.minecraft.item.ItemStack itemStack)
Draws an itemStack to the GUI.
|
void |
drawItemStack(net.minecraft.item.ItemStack itemStack,
int x,
int y)
Draws an itemStack to the GUI at the specified coordinates.
|
void |
drawItemStack(net.minecraft.item.ItemStack itemStack,
int x,
int y,
net.minecraft.util.EnumChatFormatting format)
Draws an itemStack to the GUI at the specified coordinates with a custom format for the label.
|
void |
drawItemStack(net.minecraft.item.ItemStack itemStack,
int x,
int y,
java.lang.String label)
Draws an itemStack to the GUI at the specified coordinates with a custom label.
|
void |
drawItemStack(net.minecraft.item.ItemStack itemStack,
int x,
int y,
java.lang.String label,
net.minecraft.util.EnumChatFormatting format,
boolean relative)
Draws itemStack to the GUI at the specified coordinates with a custom formatted label.
|
void |
drawRectangle(int x,
int y,
int z,
int width,
int height,
int color,
int alpha) |
void |
drawRectangle(int x,
int y,
int z,
int width,
int height,
int color,
int alpha,
boolean relative) |
void |
drawScreen(UIContainer container,
int mouseX,
int mouseY,
float partialTick)
Draws the component to the screen.
|
void |
drawShape(GuiShape s,
RenderParameters params)
Draws a
Shape to the GUI with the specified RenderParameters . |
void |
drawText(java.lang.String text)
Draws a white text on the GUI without shadow.
|
void |
drawText(java.lang.String text,
int color,
boolean shadow)
Draws a text on the GUI with specified color and shadow.
|
void |
drawText(java.lang.String text,
int x,
int y)
Draws a white text on the GUI without shadow, at the specified coordinates, relative to its parent container.
|
void |
drawText(java.lang.String text,
int x,
int y,
int color,
boolean shadow)
Draws a text on the GUI at the specified coordinates, relative to its parent container, with color and shadow.
|
void |
drawText(java.lang.String text,
int x,
int y,
int z,
int color,
boolean shadow,
boolean relative)
Draws a string at the specified coordinates, with color and shadow.
|
void |
drawTooltip(UITooltip tooltip)
Draws a
UITooltip to the screen. |
void |
endClipping(ClipArea area)
Ends the clipping.
|
static float |
getCharWidth(char c)
Gets the rendering width of a char.
|
static float |
getCharWidth(char c,
float fontScale)
Gets the rendering width of a char with the specified fontScale.
|
GuiTexture |
getDefaultTexture()
Gets the default
GuiTexture . |
static int |
getMaxStringWidth(java.util.List<java.lang.String> strings)
Gets the max string width.
|
static int |
getMaxStringWidth(java.util.List<java.lang.String> strings,
float fontScale)
Gets max rendering width of an array of string.
|
static int |
getStringHeight()
Gets the rendering height of strings.
|
static int |
getStringHeight(float fontScale)
Gets the rendering height of strings according to fontscale.
|
static int |
getStringWidth(java.lang.String str)
Gets rendering width of a string.
|
static int |
getStringWidth(java.lang.String str,
float fontScale)
Gets rendering width of a string according to fontScale.
|
boolean |
isIgnoreScale()
Checks if Minecraft GUI scale is ignored
|
void |
next()
Next.
|
void |
prepare(RenderType renderType,
double... data)
Prepares the
Tessellator and the GL states for the renderType. |
static java.lang.String |
processString(java.lang.String str) |
void |
renderPickedItemStack(net.minecraft.item.ItemStack itemStack)
Render the picked up itemStack at the cursor position.
|
void |
set(int mouseX,
int mouseY,
float partialTicks)
Sets the mouse position and the partial tick.
|
void |
setDefaultTexture(GuiTexture texture) |
void |
setFontScale(float scale)
Sets a custom font scale factor.
|
void |
setIgnoreScale(boolean ignore)
Sets whether to ignore default Minecraft GUI scale factor.
|
void |
startClipping(ClipArea area)
Starts clipping an area to prevent drawing outside of it.
|
int |
updateGuiScale()
Sets the width, height and scale factor for this
GuiRenderer . |
static java.util.List<java.lang.String> |
wrapText(java.lang.String text,
int maxWidth)
Splits the string in multiple lines to fit in the specified maxWidth.
|
static java.util.List<java.lang.String> |
wrapText(java.lang.String text,
int maxWidth,
float fontScale)
Splits the string in multiple lines to fit in the specified maxWidth using the specified fontScale.
|
_initialize, applyTexture, bindTexture, calcVertexBrightness, calcVertexColor, calcVertexesPosition, disableTextures, draw, drawFace, drawFace, drawShape, drawShape, drawString, drawVertex, drawVertexes, enableBlending, enableTextures, getAoBrightness, getBaseBrightness, getBlockAmbientOcclusion, getBlockDestroyProgress, getDamagedBlocks, getFontRenderer, getIcon, getMixedBrightnessForBlock, getPartialTick, getRenderBounds, getRenderId, handleRenderType, initialize, isCurrentBlockDestroyProgress, next, registerFor, registerFor, registerForRenderWorldLast, render, renderDestroyProgress, renderInventoryBlock, renderItem, renderStandard, renderStandard, renderTileEntityAt, renderWorldBlock, renderWorldLastEvent, reset, set, set, set, set, set, set, set, set, shouldRender, shouldRender3DInInventory, shouldRenderFace, shouldSetViewportPosition, shouldUseRenderHelper, startDrawing, startDrawing, tessellatorShift, tessellatorUnshift
public static net.minecraft.client.renderer.entity.RenderItem itemRenderer
public static int FONT_HEIGHT
public static java.util.Map<java.lang.Character,net.minecraft.util.EnumChatFormatting> charFormats
public UIComponent currentComponent
public int mouseX
public int mouseY
public GuiRenderer()
GuiRenderer
.public GuiTexture getDefaultTexture()
GuiTexture
.public void setDefaultTexture(GuiTexture texture)
public void setIgnoreScale(boolean ignore)
ignore
- the new ignore scalepublic boolean isIgnoreScale()
public void setFontScale(float scale)
scale
- the new font scalepublic int updateGuiScale()
GuiRenderer
.public void set(int mouseX, int mouseY, float partialTicks)
mouseX
- the mouse xmouseY
- the mouse ypartialTicks
- the partial tickspublic void prepare(RenderType renderType, double... data)
MalisisRenderer
Tessellator
and the GL states for the renderType. data is only used for TESR and IRWL.prepare
in class MalisisRenderer
renderType
- the render typedata
- the datapublic void clean()
MalisisRenderer
clean
in class MalisisRenderer
public void next()
next
in class MalisisRenderer
public void bindTexture(GuiTexture texture)
texture
- the texturepublic void bindDefaultTexture()
defaultGuiTexture
.public void applyTexture(Shape shape, RenderParameters parameters)
Shape
.applyTexture
in class MalisisRenderer
shape
- the shapeparameters
- the parameterspublic void drawScreen(UIContainer container, int mouseX, int mouseY, float partialTick)
container
- the containermouseX
- the mouse xmouseY
- the mouse ypartialTick
- the partial tickpublic void drawShape(GuiShape s, RenderParameters params)
Shape
to the GUI with the specified RenderParameters
.s
- the sparams
- the paramspublic void drawRectangle(int x, int y, int z, int width, int height, int color, int alpha)
public void drawRectangle(int x, int y, int z, int width, int height, int color, int alpha, boolean relative)
public void drawTooltip(UITooltip tooltip)
UITooltip
to the screen.tooltip
- the tooltippublic void drawText(java.lang.String text)
text
- the textpublic void drawText(java.lang.String text, int color, boolean shadow)
text
- the textcolor
- the colorshadow
- the shadowpublic void drawText(java.lang.String text, int x, int y)
text
- the textx
- the xy
- the ypublic void drawText(java.lang.String text, int x, int y, int color, boolean shadow)
text
- the textx
- the xy
- the ycolor
- the colorshadow
- the shadowpublic void drawText(java.lang.String text, int x, int y, int z, int color, boolean shadow, boolean relative)
text
- the textx
- the xy
- the yz
- the zcolor
- the colorshadow
- the shadowrelative
- true if the coordinates are relatives to current componentpublic void drawItemStack(net.minecraft.item.ItemStack itemStack)
itemStack
- the item stackpublic void drawItemStack(net.minecraft.item.ItemStack itemStack, int x, int y)
itemStack
- the item stackx
- the xy
- the ypublic void drawItemStack(net.minecraft.item.ItemStack itemStack, int x, int y, net.minecraft.util.EnumChatFormatting format)
itemStack
- the item stackx
- the xy
- the yformat
- the formatpublic void drawItemStack(net.minecraft.item.ItemStack itemStack, int x, int y, java.lang.String label)
itemStack
- the item stackx
- the xy
- the ylabel
- the labelpublic void drawItemStack(net.minecraft.item.ItemStack itemStack, int x, int y, java.lang.String label, net.minecraft.util.EnumChatFormatting format, boolean relative)
itemStack
- the item stackx
- the xy
- the ylabel
- the label to display, if null display the stack sizeformat
- the formatrelative
- if true, coordinates are relative to current componentpublic void renderPickedItemStack(net.minecraft.item.ItemStack itemStack)
itemStack
- the item stackpublic void startClipping(ClipArea area)
area
- the areapublic void endClipping(ClipArea area)
area
- the areapublic static java.lang.String processString(java.lang.String str)
public static java.lang.String clipString(java.lang.String text, int width)
text
- the textwidth
- the widthpublic static java.lang.String clipString(java.lang.String text, int width, float fontScale)
text
- the textwidth
- the widthfontScale
- the font scalepublic static java.lang.String clipString(java.lang.String text, int width, float fontScale, boolean appendPeriods)
public static int getStringWidth(java.lang.String str)
str
- the strpublic static int getStringWidth(java.lang.String str, float fontScale)
str
- the strfontScale
- the font scalepublic static int getStringHeight()
public static int getStringHeight(float fontScale)
fontScale
- the font scalepublic static int getMaxStringWidth(java.util.List<java.lang.String> strings)
strings
- the stringspublic static int getMaxStringWidth(java.util.List<java.lang.String> strings, float fontScale)
strings
- the stringsfontScale
- the font scalepublic static float getCharWidth(char c)
c
- the cpublic static float getCharWidth(char c, float fontScale)
c
- the cfontScale
- the font scalepublic static java.util.List<java.lang.String> wrapText(java.lang.String text, int maxWidth)
text
- the textmaxWidth
- the max widthpublic static java.util.List<java.lang.String> wrapText(java.lang.String text, int maxWidth, float fontScale)
text
- the textmaxWidth
- the max widthfontScale
- the font scale