Class RenderHelper

java.lang.Object
org.moddingx.libx.render.RenderHelper

public class RenderHelper extends Object
Some utilities for rendering in general.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    argb(int color)
    Sets the color to the given ARGB color in format 0xAARRGGBB
    static void
    renderGuiBackground(net.minecraft.client.gui.GuiGraphics graphics, int x, int y, int width, int height)
    Same as renderGuiBackground 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 as renderGuiBackground 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 texture
    static 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 as repeatBlit(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TEXTURE_WHITE

      public static final net.minecraft.resources.ResourceLocation TEXTURE_WHITE
      ResourceLocation of a texture with the size 512x512 that is purely white. It can be colored with RenderSystem.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 as repeatBlit(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 corner
      y - y coordinate of top-left corner
      texWidth - 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 blit
      displayHeight - the height of the blit
      sprite - 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 as repeatBlit(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 corner
      y - y coordinate of top-left corner
      sprite - A texture sprite
      width - The width of the icon
      height - The height of the icon
      alpha - The alpha value that should be used.
      color - A color in format 0xRRGGBB
      light - Light value
      overlay - 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 as renderGuiBackground 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 as renderGuiBackground 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 background
      height - The height of the GUI background
      texture - The texture to use for the GUI background
      textureX - Texture size x
      textureY - Texture size y
      minU - The minimum u position for the filling part of the texture
      maxU - The maximum u position for the filling part of the texture
      minV - The minimum v position for the filling part of the texture
      maxV - The maximum v position for the filling part of the texture