Fix item icons not being rendered correctly

This commit is contained in:
DBotThePony 2024-01-02 14:38:58 +07:00
parent 8d42686cc5
commit cae417b3b4
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 9 additions and 2 deletions

View File

@ -129,7 +129,7 @@ data class ItemStackIcon(private val itemStack: ItemStack, override val width: F
pose.scale(width / 16f, height / 16f, 1f)
guiGraphics.setColor(color.red, color.green, color.blue, color.alpha)
guiGraphics.renderFakeItem(itemStack, 0, 0)
guiGraphics.renderFakeItem(pose, itemStack, 0, 0)
pose.popPose()
clearDepth(pose, x, y, width, height)

View File

@ -34,8 +34,15 @@ class MGUIGraphics(val pose: PoseStack) {
RenderSystem.setShaderColor(red, green, blue, alpha)
}
fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) {
fun renderFakeItem(poseStack: PoseStack, itemStack: ItemStack, x: Int, y: Int) {
val global = RenderSystem.getModelViewStack()
global.pushPose()
global.last().pose().mul(poseStack.last().pose())
global.last().normal().mul(poseStack.last().normal())
RenderSystem.applyModelViewMatrix()
minecraft.itemRenderer.renderGuiItem(itemStack, x, y)
global.popPose()
RenderSystem.applyModelViewMatrix()
}
fun drawLine(