More backporting

This commit is contained in:
DBotThePony 2024-01-02 00:33:01 +07:00
parent 09f4db3fa9
commit e00f79c736
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 25 additions and 5 deletions

View File

@ -9,7 +9,6 @@ import com.mojang.blaze3d.vertex.VertexFormat
import net.minecraft.client.gui.Font
import net.minecraft.client.gui.GuiComponent
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent
import net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil
import net.minecraft.client.renderer.GameRenderer
import net.minecraft.client.renderer.MultiBufferSource
import net.minecraft.client.renderer.texture.TextureAtlasSprite
@ -118,7 +117,25 @@ class MGUIGraphics(val pose: PoseStack) {
RenderSystem.setShader { GameRenderer.getPositionColorShader() }
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR)
val matrix4f = pose.last().pose()
TooltipRenderUtil.renderTooltipBackground(GuiComponent::fillGradient, matrix4f, bufferbuilder, x, y, totalWidth, totalHeight, 400)
run {
val j2 = x
val k2 = y
val j = totalHeight
val i = totalWidth
val colorEvent = ForgeHooksClient.onRenderTooltipColor(itemStack, pose, j2, k2, preEvent.font, mapped)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, colorEvent.backgroundStart, colorEvent.backgroundStart)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, colorEvent.backgroundEnd, colorEvent.backgroundEnd)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, colorEvent.backgroundStart, colorEvent.backgroundEnd)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, colorEvent.backgroundStart, colorEvent.backgroundEnd)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, colorEvent.backgroundStart, colorEvent.backgroundEnd)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, colorEvent.borderStart, colorEvent.borderEnd)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, colorEvent.borderStart, colorEvent.borderEnd)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, colorEvent.borderStart, colorEvent.borderStart)
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, colorEvent.borderEnd, colorEvent.borderEnd)
}
RenderSystem.enableDepthTest()
RenderSystem.disableTexture()
RenderSystem.enableBlend()
@ -308,14 +325,14 @@ class MGUIGraphics(val pose: PoseStack) {
fun renderSprite(
sprite: TextureAtlasSprite, x: Float, y: Float,
width: Float = sprite.contents().width().toFloat(),
height: Float = sprite.contents().height().toFloat(),
width: Float = sprite.width.toFloat(),
height: Float = sprite.height.toFloat(),
color: RGBAColor = RGBAColor.WHITE
) {
renderTexturedRect(
x, y, width, height,
uv = UVCoords(sprite.u0, sprite.v0, sprite.u1, sprite.v1),
texture = sprite.atlasLocation(),
texture = sprite.atlas().location(),
color = color
)
}

View File

@ -36,6 +36,9 @@ public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_9778
public net.minecraft.client.gui.GuiComponent m_168740_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIIII)V # fillGradient
public net.minecraft.client.gui.GuiComponent m_93123_(Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V # fillGradient
public net.minecraft.client.gui.GuiComponent m_93179_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIII)V # fillGradient
public net.minecraft.client.gui.GuiComponent m_168740_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIIII)V # fillGradient
public net.minecraft.client.gui.GuiComponent m_93123_(Lcom/mojang/math/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V # fillGradient
public net.minecraft.client.gui.GuiComponent m_93179_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIII)V # fillGradient
public net.minecraft.world.item.BlockItem f_150696_ # BLOCK_ENTITY_TAG