Class RenderHelper
java.lang.Object
org.moddingx.libx.render.RenderHelper
Some utilities for rendering in general.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.Identifierstatic final net.minecraft.resources.IdentifierIdentifier of a texture with the size 256x256 that is purely white. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidargb(int color) Sets the color to the given ARGB color in format 0xAARRGGBBstatic voidrenderGuiBackground(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height) Same asrenderGuiBackgroundbut with pre-set texture.static voidrenderGuiBackground(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height, net.minecraft.resources.Identifier texture) Same asrenderGuiBackground.static voidrenderGuiBackground(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height, net.minecraft.resources.Identifier texture, int textureX, int textureY, int minU, int maxU, int minV, int maxV) Renders a gui background of any size.static voidrenderIconColored(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 voidrenderItem(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.ItemDisplayContext displayContext, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.MultiBufferSource buffer, int packedLight, int packedOverlay) Renders anItemStackinto aMultiBufferSource.static voidrepeatBlit(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) Repeatedly blits a texturestatic voidrepeatBlit(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) static voidrepeatBlit(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.resources.Identifier texture, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, float minU, float maxU, float minV, float maxV) Same asrepeatBlit(RenderPipeline, GuiGraphicsExtractor, int, int, int, int, int, int, TextureAtlasSprite)but with the u and v values set directly and not with a TextureAtlasSprite.static voidResets the color to white.static voidrgb(int color) Sets the color to the given RGB color in format 0xRRGGBB
-
Field Details
-
TEXTURE_WHITE
public static final net.minecraft.resources.Identifier TEXTURE_WHITEIdentifier of a texture with the size 256x256 that is purely white. -
TEXTURE_CHEST_GUI
public static final net.minecraft.resources.Identifier TEXTURE_CHEST_GUI
-
-
Constructor Details
-
RenderHelper
public RenderHelper()
-
-
Method Details
-
repeatBlit
public static void repeatBlit(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int displayWidth, int displayHeight, net.minecraft.client.renderer.texture.TextureAtlasSprite sprite) Same asrepeatBlit(RenderPipeline, GuiGraphicsExtractor, int, int, int, int, int, int, TextureAtlasSprite). texWidth and texHeight are set from the sprite. -
repeatBlit
public static void repeatBlit(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor 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(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.resources.Identifier texture, int x, int y, int texWidth, int texHeight, int displayWidth, int displayHeight, float minU, float maxU, float minV, float maxV) Same asrepeatBlit(RenderPipeline, GuiGraphicsExtractor, 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- AVertexConsumerused 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. -
renderItem
public static void renderItem(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.ItemDisplayContext displayContext, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.MultiBufferSource buffer, int packedLight, int packedOverlay) Renders anItemStackinto aMultiBufferSource. This bridges the 1.21.10 submission-based item rendering (ItemStackRenderState) back to a buffer source, which is needed insideRenderJob.render(PoseStack, MultiBufferSource).- Parameters:
stack- The item stack to render.displayContext- The display context (e.g.ItemDisplayContext.GUI).poseStack- The current pose stack.buffer- The buffer source to render into.packedLight- Packed light value.packedOverlay- Packed overlay value.
-
renderGuiBackground
public static void renderGuiBackground(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height) Same asrenderGuiBackgroundbut with pre-set texture. -
renderGuiBackground
public static void renderGuiBackground(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height, net.minecraft.resources.Identifier texture) Same asrenderGuiBackground. -
renderGuiBackground
public static void renderGuiBackground(com.mojang.blaze3d.pipeline.RenderPipeline pipeline, net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height, net.minecraft.resources.Identifier 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
-