Updated skin box hiding logic

Updated skin box hiding logic after testing a newer version PCK-Studio revealing the original logic wasn't accurate, also removed code that added arm and tool offsets to held items as it was not working correctly.
This commit is contained in:
Langtanium 2026-04-28 19:21:07 -07:00
parent 28f0110339
commit 878547dec8
5 changed files with 13 additions and 56 deletions

View file

@ -270,25 +270,6 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
shared_ptr<ItemInstance> itemLeggings = mob->inventory->getArmor(1);
shared_ptr<ItemInstance> itemBoots = mob->inventory->getArmor(0);
// Hide armor layer of skin if corresponnding piece of armor is worn - Langtanium
if (itemChestplate != nullptr && resModel->texHeight == 64)
{
resModel->bodyArmor->visible=false;
resModel->armArmor0->visible=false;
resModel->armArmor1->visible=false;
}
if (itemLeggings != nullptr && resModel->texHeight == 64)
{
resModel->belt->visible=false;
resModel->legging0->visible=false;
resModel->legging1->visible=false;
}
if (itemBoots != nullptr && resModel->texHeight == 64)
{
resModel->boot0->visible=false;
resModel->boot1->visible=false;
}
// 4J-PB - any additional parts to turn on for this player (skin dependent)
vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
//turn them on
@ -296,7 +277,15 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
{
for(ModelPart *pModelPart : *pAdditionalModelParts)
{
if (itemHelmet == nullptr || !pModelPart->hideWithHelmet) // Hide the skin boxes that have the "hide when helmet is worn" flag - Langtanium
if (itemHelmet != nullptr && pModelPart->hideWithArmor&(1<<0)) // Hide the skin boxes that have the "hide when helmet is worn" bit flag - Langtanium
pModelPart->visible=false;
else if (itemChestplate != nullptr && pModelPart->hideWithArmor&(1<<1)) // Hide the skin boxes that have the "hide when chestplate is worn" bit flag - Langtanium
pModelPart->visible=false;
else if (itemLeggings != nullptr && pModelPart->hideWithArmor&(1<<2)) // Hide the skin boxes that have the "hide when leggings are worn" bit flag - Langtanium
pModelPart->visible=false;
else if (itemBoots != nullptr && pModelPart->hideWithArmor&(1<<3)) // Hide the skin boxes that have the "hide when boots are worn" bit flag - Langtanium
pModelPart->visible=false;
else
pModelPart->visible=true;
}
}