Package org.moddingx.libx.render
Class RenderHelper
java.lang.Object
org.moddingx.libx.render.RenderHelper
Some utilities for rendering in general.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocation
static final net.minecraft.resources.ResourceLocation
ResourceLocation of a texture with the size 512x512 that is purely white. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
argb
(int color) Sets the color to the given ARGB color in format 0xAARRGGBBstatic void
renderGuiBackground
(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height) Same asrenderGuiBackground
but with pre-set texture.static void
renderGuiBackground
(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height, net.minecraft.resources.ResourceLocation texture) Same asrenderGuiBackground
with the default GUI texture.static void
renderGuiBackground
(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height, net.minecraft.resources.ResourceLocation texture, int textureX, int textureY, int minU, int maxU, int minV, int maxV) Renders a gui background of any size.static void
renderIconColored
(com.mojang.blaze3d.vertex.PoseStack poseStack, com.mojang.blaze3d.vertex.VertexConsumer buffer, float x, float y, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite, float width, float height, float alpha, int color, int light, int overlay) Renders a texture colored with a given color.static void
repeatBlit
(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) Repeatedly blits a texturestatic void
repeatBlit
(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) static void
repeatBlit
(net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.resources.ResourceLocation texture, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, float minU, float maxU, float minV, float maxV) Same asrepeatBlit(GuiGraphics, int, int, int, int, int, int, TextureAtlasSprite)
but with the u and v values set directly and not with a TextureAtlasSprite.static void
Resets the color to white.static void
rgb
(int color) Sets the color to the given RGB color in format 0xRRGGBB
-
Field Details
-
TEXTURE_WHITE
public static final net.minecraft.resources.ResourceLocation TEXTURE_WHITEResourceLocation of a texture with the size 512x512 that is purely white. It can be colored withRenderSystem.setShaderColor(float, float, float, float)
. -
TEXTURE_CHEST_GUI
public static final net.minecraft.resources.ResourceLocation TEXTURE_CHEST_GUI
-
-
Constructor Details
-
RenderHelper
public RenderHelper()
-
-
Method Details
-
repeatBlit
public static void repeatBlit(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) Same asrepeatBlit(GuiGraphics, int, int, int, int, int, int, TextureAtlasSprite)
. texWidth and texHeight are set from the sprite. -
repeatBlit
public static void repeatBlit(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) Repeatedly blits a texture- Parameters:
x
- x coordinate of top-left cornery
- y coordinate of top-left cornertexWidth
- width of one texture element. If this is lower than displayWidth the texture is looped.texHeight
- height of one texture element. If this is lower than displayHeight the texture is looped.displayWidth
- the width of the blitdisplayHeight
- the height of the blitsprite
- A texture sprite
-
repeatBlit
public static void repeatBlit(net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.resources.ResourceLocation texture, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, float minU, float maxU, float minV, float maxV) Same asrepeatBlit(GuiGraphics, int, int, int, int, int, int, TextureAtlasSprite)
but with the u and v values set directly and not with a TextureAtlasSprite. -
renderIconColored
public static void renderIconColored(com.mojang.blaze3d.vertex.PoseStack poseStack, com.mojang.blaze3d.vertex.VertexConsumer buffer, float x, float y, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite, float width, float height, float alpha, int color, int light, int overlay) Renders a texture colored with a given color.- Parameters:
buffer
- A VertexBuilder used to render the sprite.x
- x coordinate of top-left cornery
- y coordinate of top-left cornersprite
- A texture spritewidth
- The width of the iconheight
- The height of the iconalpha
- The alpha value that should be used.color
- A color in format 0xRRGGBBlight
- Light valueoverlay
- Value on the overlay map.
-
rgb
public static void rgb(int color) Sets the color to the given RGB color in format 0xRRGGBB -
argb
public static void argb(int color) Sets the color to the given ARGB color in format 0xAARRGGBB -
resetColor
public static void resetColor()Resets the color to white. -
renderGuiBackground
public static void renderGuiBackground(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height) Same asrenderGuiBackground
but with pre-set texture. -
renderGuiBackground
public static void renderGuiBackground(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height, net.minecraft.resources.ResourceLocation texture) Same asrenderGuiBackground
with the default GUI texture. -
renderGuiBackground
public static void renderGuiBackground(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height, net.minecraft.resources.ResourceLocation texture, int textureX, int textureY, int minU, int maxU, int minV, int maxV) Renders a gui background of any size. This is created from the chest GUI texture and should work with texture packs. The width and height must be at least 9.- Parameters:
x
- The x position for the top left corner.y
- The y position for the top left corner.width
- The width of the GUI backgroundheight
- The height of the GUI backgroundtexture
- The texture to use for the GUI backgroundtextureX
- Texture size xtextureY
- Texture size yminU
- The minimum u position for the filling part of the texturemaxU
- The maximum u position for the filling part of the textureminV
- The minimum v position for the filling part of the texturemaxV
- The maximum v position for the filling part of the texture
-