Class RenderUtils

java.lang.Object
me.desht.pneumaticcraft.client.util.RenderUtils

public class RenderUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int[]
    decomposeColor(int color)
    Decompose a 32-bit color into ARGB 8-bit int values
    static float[]
    decomposeColorF(int color)
     
    static void
    drawTexture(com.mojang.blaze3d.vertex.PoseStack matrixStack, com.mojang.blaze3d.vertex.VertexConsumer builder, int x, int y, float u1, float v1, float u2, float v2, int packedLightIn)
     
    static void
    drawTexture(com.mojang.blaze3d.vertex.PoseStack matrixStack, com.mojang.blaze3d.vertex.VertexConsumer builder, int x, int y, int packedLightIn)
     
    static void
    finishBuffer(net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.client.renderer.RenderType type)
     
    static void
    normalLine(com.mojang.blaze3d.vertex.VertexConsumer builder, org.joml.Matrix4f posMat, org.joml.Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2, float a, float r, float g, float b, boolean isStrip)
     
    static com.mojang.blaze3d.vertex.VertexConsumer
    posF(com.mojang.blaze3d.vertex.VertexConsumer builder, org.joml.Matrix4f posMat, double x, double y, double z)
    Convenience method to get double coords into VertexConsumer.vertex(Matrix4f, float, float, float)
    static net.minecraft.client.renderer.RenderType
    renderFrame(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.world.phys.AABB aabb, float fw, float r, float g, float b, float a, int packedLightIn, net.minecraft.core.Direction... sides)
     
    static void
    renderProgressingLine3d(ProgressingLine prev, ProgressingLine line, float partialTick, com.mojang.blaze3d.vertex.PoseStack matrixStack, com.mojang.blaze3d.vertex.VertexConsumer builder, int color)
     
    static void
    renderRing(ProgressingLine line, ProgressingLine lastLine, com.mojang.blaze3d.vertex.PoseStack matrixStackIn, net.minecraft.client.renderer.MultiBufferSource bufferIn, float partialTick, float rotationYaw, float rotationPitch, int color)
     
    static void
    renderString3d(net.minecraft.network.chat.Component str, float x, float y, int color, com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, boolean dropShadow, boolean disableDepthTest)
     
    static void
    renderWithType(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.client.renderer.RenderType type, BiConsumer<org.joml.Matrix4f,com.mojang.blaze3d.vertex.VertexConsumer> consumer)
     
    static void
    renderWithTypeAndFinish(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.client.renderer.RenderType type, BiConsumer<org.joml.Matrix4f,com.mojang.blaze3d.vertex.VertexConsumer> consumer)
     
    static float
    rotateMatrixForDirection(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.core.Direction facing)
    Rotates the render matrix dependant on the rotation of a block.
    static void
    rotateToPlayerFacing(com.mojang.blaze3d.vertex.PoseStack matrixStack)
    Rotate the matrix so that subsequent drawing is oriented toward the player's facing.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • RenderUtils

      public RenderUtils()
  • Method Details

    • decomposeColor

      public static int[] decomposeColor(int color)
      Decompose a 32-bit color into ARGB 8-bit int values
      Parameters:
      color - color to decompose
      Returns:
      4-element array of ints
    • decomposeColorF

      public static float[] decomposeColorF(int color)
    • renderFrame

      public static net.minecraft.client.renderer.RenderType renderFrame(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.world.phys.AABB aabb, float fw, float r, float g, float b, float a, int packedLightIn, net.minecraft.core.Direction... sides)
    • rotateMatrixForDirection

      public static float rotateMatrixForDirection(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.core.Direction facing)
      Rotates the render matrix dependant on the rotation of a block. Used by many block entity render methods.
      Parameters:
      matrixStack - the matrix stack
      facing - block facing direction
      Returns:
      the angle (in degrees) of resulting rotation around the Y axis
    • renderProgressingLine3d

      public static void renderProgressingLine3d(ProgressingLine prev, ProgressingLine line, float partialTick, com.mojang.blaze3d.vertex.PoseStack matrixStack, com.mojang.blaze3d.vertex.VertexConsumer builder, int color)
    • renderRing

      public static void renderRing(ProgressingLine line, ProgressingLine lastLine, com.mojang.blaze3d.vertex.PoseStack matrixStackIn, net.minecraft.client.renderer.MultiBufferSource bufferIn, float partialTick, float rotationYaw, float rotationPitch, int color)
    • rotateToPlayerFacing

      public static void rotateToPlayerFacing(com.mojang.blaze3d.vertex.PoseStack matrixStack)
      Rotate the matrix so that subsequent drawing is oriented toward the player's facing. Useful for drawing HUD elements in 3D space which need to face the player.
      Parameters:
      matrixStack - the matrix stack
    • drawTexture

      public static void drawTexture(com.mojang.blaze3d.vertex.PoseStack matrixStack, com.mojang.blaze3d.vertex.VertexConsumer builder, int x, int y, int packedLightIn)
    • drawTexture

      public static void drawTexture(com.mojang.blaze3d.vertex.PoseStack matrixStack, com.mojang.blaze3d.vertex.VertexConsumer builder, int x, int y, float u1, float v1, float u2, float v2, int packedLightIn)
    • posF

      public static com.mojang.blaze3d.vertex.VertexConsumer posF(com.mojang.blaze3d.vertex.VertexConsumer builder, org.joml.Matrix4f posMat, double x, double y, double z)
      Convenience method to get double coords into VertexConsumer.vertex(Matrix4f, float, float, float)
      Parameters:
      builder - the vertex builder
      posMat - the positioning matrix
      x - X
      y - Y
      z - Z
      Returns:
      the vertex builder, for method chaining
    • finishBuffer

      public static void finishBuffer(net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.client.renderer.RenderType type)
    • renderWithTypeAndFinish

      public static void renderWithTypeAndFinish(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.client.renderer.RenderType type, BiConsumer<org.joml.Matrix4f,com.mojang.blaze3d.vertex.VertexConsumer> consumer)
    • renderWithType

      public static void renderWithType(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, net.minecraft.client.renderer.RenderType type, BiConsumer<org.joml.Matrix4f,com.mojang.blaze3d.vertex.VertexConsumer> consumer)
    • renderString3d

      public static void renderString3d(net.minecraft.network.chat.Component str, float x, float y, int color, com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, boolean dropShadow, boolean disableDepthTest)
    • normalLine

      public static void normalLine(com.mojang.blaze3d.vertex.VertexConsumer builder, org.joml.Matrix4f posMat, org.joml.Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2, float a, float r, float g, float b, boolean isStrip)