From 8e77eb70de1d203857aec745458876ce5a62d910 Mon Sep 17 00:00:00 2001 From: qloak Date: Tue, 14 Jul 2026 12:57:08 -0700 Subject: [PATCH] fix horse layered texture rendering for platforms without multitexture support --- Minecraft.Client/HorseRenderer.cpp | 32 +++++++++++++++++++++++++++--- Minecraft.Client/Textures.cpp | 6 +++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/HorseRenderer.cpp b/Minecraft.Client/HorseRenderer.cpp index 08ba49a2..97f75df1 100644 --- a/Minecraft.Client/HorseRenderer.cpp +++ b/Minecraft.Client/HorseRenderer.cpp @@ -46,9 +46,35 @@ void HorseRenderer::renderModel(shared_ptr mob, float wp, float ws } else { - EntityRenderer::bindTexture(mob); - model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); - // Ensure that any extra layers of texturing are disabled after rendering this horse + shared_ptr horse = dynamic_pointer_cast(mob); + ResourceLocation *location = getTextureLocation(mob); + + // Pass 1: Bind only the coat texture (first valid layer) and render opaque + int coatTex = location->getTexture(0); + if( coatTex != -1 ) + { + RenderManager.TextureBind(entityRenderDispatcher->textures->loadTexture(coatTex)); + } + model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); + + // Pass 2: If horse has armor, find the armor texture in the layers and render with blending + int armorType = horse->getArmorType(); + if( armorType > 0 ) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + for( int i = 1; i < location->getTextureCount(); i++ ) + { + int texId = location->getTexture(i); + if( texId != -1 ) + { + RenderManager.TextureBind(entityRenderDispatcher->textures->loadTexture(texId)); + model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true); + } + } + glDisable(GL_BLEND); + } + RenderManager.TextureBind(-1); } } diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index 9a9b79fd..bce056be 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -434,7 +434,11 @@ void Textures::bindTextureLayers(ResourceLocation *resource) for( int i = 0; i < layers; i++ ) { - RenderManager.TextureBind(loadTexture(resource->getTexture(i))); + int texId = resource->getTexture(i); + if( texId != -1 ) + { + RenderManager.TextureBind(loadTexture(texId)); + } } }