Class RenderUtil

java.lang.Object
etithespirit.orimod.client.render.debug.RenderUtil

public final class RenderUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.client.renderer.RenderType
    A render type used for translucent quads.
    Adapted heavily from Compact Crafting CCRenderTypes by robotgryphon.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addColoredVertex(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.world.phys.Vec3 position)
    Provides a means of rendering colored lines or quads.
    static void
    addColoredVertex(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.world.phys.Vec3 position, net.minecraft.core.Direction normal)
    Provides a means of rendering colored lines or quads.
    static void
    drawBox(net.minecraft.world.phys.AABB bounds, com.mojang.blaze3d.vertex.PoseStack mtx, com.mojang.blaze3d.vertex.VertexConsumer builder, int argb, float argbDivisor)
    Draws a box representing the given AABB.
    static void
    drawCubeFrame(net.minecraft.world.phys.AABB bounds, com.mojang.blaze3d.vertex.PoseStack mtx, com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, int argb, float argbDivisor)
    Draw an axis-aligned bounding box's outline.
    static void
    drawWideCubeFrame(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.core.BlockPos blockStart, net.minecraft.core.BlockPos blockEnd, double size)
    Draws a wireframe tube between two block positions.
    static void
    drawWideCubeSolid(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.core.BlockPos blockStart, net.minecraft.core.BlockPos blockEnd, double size)
    Draws a cube frame as a tube between two block positions.
    static net.minecraft.world.phys.AABB
    getAABBEnclosing(net.minecraft.core.BlockPos blockStart, net.minecraft.core.BlockPos blockEnd, double size)
    Returns an AABB containing the two given BlockPos center points.
    static int
    randomIndexedRGB(int index)
     
    static int
    Returns a random RGB color with full alpha (maximum opacity).
    static int
    randomRGB(int alpha)
    Returns a random RGB color with the given alpha.
    static void
    renderText(String text, com.mojang.blaze3d.vertex.PoseStack mtx, net.minecraft.client.Camera renderInfo, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.core.BlockPos at, int argb, boolean renderBetterThroughWalls)
    Renders text in a manner akin to an entity name at the given BlockPos.
    static void
    renderText(String text, com.mojang.blaze3d.vertex.PoseStack mtx, net.minecraft.client.Camera renderInfo, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.world.phys.Vec3 at, int argb, boolean renderBetterThroughWalls)
    Renders text in a manner akin to an entity name at the given Vec3

    Methods inherited from class java.lang.Object

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

    • TRANSLUCENT_SOLID

      public static final net.minecraft.client.renderer.RenderType TRANSLUCENT_SOLID
      A render type used for translucent quads.
      Adapted heavily from Compact Crafting CCRenderTypes by robotgryphon.
  • Method Details

    • addColoredVertex

      public static void addColoredVertex(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.world.phys.Vec3 position)
      Provides a means of rendering colored lines or quads. Politely borrowed from Compact Crafting.
      Parameters:
      vtxBuilder - The vertex builder.
      mtx - The matrix that this vertex is affected by.
      argb - The color of the vertex.
      position - The location of the vertex.
    • addColoredVertex

      public static void addColoredVertex(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.world.phys.Vec3 position, net.minecraft.core.Direction normal)
      Provides a means of rendering colored lines or quads. Politely borrowed from Compact Crafting
      Parameters:
      vtxBuilder - The vertex builder.
      mtx - The matrix that this vertex is affected by.
      argb - The color of the vertex.
      position - The location of the vertex.
    • randomRGB

      public static int randomRGB(int alpha)
      Returns a random RGB color with the given alpha.
      Parameters:
      alpha - The alpha to apply to this color (0-255)
      Returns:
      A numeric value in ARGB format.
    • randomRGB

      public static int randomRGB()
      Returns a random RGB color with full alpha (maximum opacity).
      Returns:
      A numeric value in ARGB format.
    • randomIndexedRGB

      public static int randomIndexedRGB(int index)
      Returns:
      A preset (but initially randomly selected) RGB color for the given index number.
    • getAABBEnclosing

      public static net.minecraft.world.phys.AABB getAABBEnclosing(net.minecraft.core.BlockPos blockStart, net.minecraft.core.BlockPos blockEnd, double size)
      Returns an AABB containing the two given BlockPos center points. The size property dictates how much to expand it by on all axes.
      Parameters:
      blockStart - The start position.
      blockEnd - The end position.
      size - The "extra room" given for the AABB. A value of 1 makes it surround both of the blocks on their edges.
      Returns:
      An AABB containing the two BlockPos instances.
    • drawWideCubeFrame

      public static void drawWideCubeFrame(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.core.BlockPos blockStart, net.minecraft.core.BlockPos blockEnd, double size)
      Draws a wireframe tube between two block positions.
      Parameters:
      vtxBuilder - The vertex builder. This should be one that builds with quads.
      mtx - The matrix stack for positioning the vertices.
      argb - The color in ARGB format.
      argbDivisor - A divisor applied to all four components of the ARGB value. This should be 255 for floating point colors and 1 for byte colors, but it can really be anything.
      blockStart - The start position of the frame. This uses the center of the block.
      blockEnd - The end position of the frame. This uses the center of the block.
      size - The diameter of the wireframe tube.
    • drawCubeFrame

      public static void drawCubeFrame(net.minecraft.world.phys.AABB bounds, com.mojang.blaze3d.vertex.PoseStack mtx, com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, int argb, float argbDivisor)
      Draw an axis-aligned bounding box's outline. To render an opaque cube, use drawBox(AABB, PoseStack, VertexConsumer, int, float)/
      Parameters:
      bounds - The bounding box to draw.
      mtx - The MatrixStack that controls the rendered position.
      vtxBuilder - The vertex builder that allows drawing the lines.
      argb - The ARGB integer color of the box.
      argbDivisor - When converting ARGB integer into floating point, the value is divided by this. By default, this should be 255 for an exact representation. Lower values will cause a bias to brighter colors. 0 will break everything. Don't divide by 0.
    • drawWideCubeSolid

      public static void drawWideCubeSolid(com.mojang.blaze3d.vertex.VertexConsumer vtxBuilder, com.mojang.blaze3d.vertex.PoseStack mtx, int argb, float argbDivisor, net.minecraft.core.BlockPos blockStart, net.minecraft.core.BlockPos blockEnd, double size)
      Draws a cube frame as a tube between two block positions.
      Parameters:
      vtxBuilder - The vertex builder. This should be one that builds with quads, and that uses translucent rendering.
      mtx - The matrix stack for positioning the vertices.
      argb - The color in ARGB format.
      argbDivisor - A divisor applied to all four components of the ARGB value. This should be 255 for floating point colors and 1 for byte colors, but it can really be anything.
      blockStart - The start position of the frame. This uses the center of the block.
      blockEnd - The end position of the frame. This uses the center of the block.
      size - The diameter of the wireframe tube.
    • drawBox

      public static void drawBox(net.minecraft.world.phys.AABB bounds, com.mojang.blaze3d.vertex.PoseStack mtx, com.mojang.blaze3d.vertex.VertexConsumer builder, int argb, float argbDivisor)
      Draws a box representing the given AABB.
      Parameters:
      bounds - The box to draw.
      mtx - The matrix used to place the vertices.
      builder - The thing used to actually put the vertices down in the first place.
      argb - The color of the box in ARGB format.
      argbDivisor - A divisor applied to all four components of the ARGB value. This should be 255 for floating point colors and 1 for byte colors, but it can really be anything.
    • renderText

      public static void renderText(String text, com.mojang.blaze3d.vertex.PoseStack mtx, net.minecraft.client.Camera renderInfo, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.world.phys.Vec3 at, int argb, boolean renderBetterThroughWalls)
      Renders text in a manner akin to an entity name at the given Vec3
      Parameters:
      text - The text to display.
      mtx - The matrix stack defining where this text should go.
      renderInfo - The current player's camera.
      buffer - Something to provide render buffers.
      at - The location of the text in world space.
      argb - The color of the text.
      renderBetterThroughWalls - If true, text behind will render about half opaque instead of basically invisible.
    • renderText

      public static void renderText(String text, com.mojang.blaze3d.vertex.PoseStack mtx, net.minecraft.client.Camera renderInfo, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.core.BlockPos at, int argb, boolean renderBetterThroughWalls)
      Renders text in a manner akin to an entity name at the given BlockPos. This will add 1 to the Y component of the given position.
      Parameters:
      text - The text to display.
      mtx - The matrix stack defining where this text should go.
      renderInfo - The current player's camera.
      buffer - Something to provide render buffers.
      at - The location of the text in world space.
      argb - The color of the text.
      renderBetterThroughWalls - If true, text behind will render about half opaque instead of basically invisible.