diff options
| author | Botch <r.zncwalker+minecraft@gmail.com> | 2026-03-28 13:44:27 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-28 14:44:27 -0500 |
| commit | 277d74716e9a2c937500e16273727a24f49508ee (patch) | |
| tree | cc4d902056c80c922773be5e0e61dff0e9becc9d /Minecraft.Client | |
| parent | 7447fabe0d8d97b42a6c9fb58ac121d2bb04372a (diff) | |
Render custom skin boxes on viewmodel (#1415)
* Update PlayerRenderer.cpp
* Fix fatal bug where skins with no additional boxes would crash the game
Diffstat (limited to 'Minecraft.Client')
| -rw-r--r-- | Minecraft.Client/PlayerRenderer.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index a9b94544..23dff77f 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -519,6 +519,29 @@ void PlayerRenderer::renderHand() { humanoidModel->arm0->render(1 / 16.0f,true); } + + + //Render custom skin boxes on viewmodel - Botch + vector<ModelPart*>* additionalModelParts = Minecraft::GetInstance()->player->GetAdditionalModelParts(); + if (!additionalModelParts) return; //If there are no custom boxes, return. This fixes bug where the game will crash if you select a skin with no additional boxes. + vector<ModelPart*> armchildren = humanoidModel->arm0->children; + std::unordered_set<ModelPart*> additionalModelPartSet(additionalModelParts->begin(), additionalModelParts->end()); + for (const auto& x : armchildren) { + if (x) { + if (additionalModelPartSet.find(x) != additionalModelPartSet.end()) { //This is to verify box is still actually on current skin - Botch + glPushMatrix(); + //We need to transform to match offset of arm - Botch + glTranslatef(-5 * 0.0625f, 2 * 0.0625f, 0); + glRotatef(0.1 * (180.0f / PI), 0, 0, 1); + x->visible = true; + x->render(1.0f / 16.0f, true); + x->visible = false; + glPopMatrix(); + } + } + } + + } void PlayerRenderer::setupPosition(shared_ptr<LivingEntity> _mob, double x, double y, double z) @@ -580,4 +603,4 @@ ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr<Entity> entity) { shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity); return new ResourceLocation(static_cast<_TEXTURE_NAME>(player->getTexture())); -}
\ No newline at end of file +} |
