mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-17 09:42:54 +00:00
Added code for hiding armor layer of skin
Added code for hiding the skins' armor layer when the corresponding pieces of armor are worn.
This commit is contained in:
parent
e0cf6f23c1
commit
1ee0337cba
|
|
@ -264,6 +264,31 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
|
|||
armorParts2->idle=false;
|
||||
}
|
||||
|
||||
// Get armor in armor slot so we can hide the armor layer of the skin - Langtanium
|
||||
shared_ptr<ItemInstance> itemHelmet = mob->inventory->getArmor(3);
|
||||
shared_ptr<ItemInstance> itemChestplate = mob->inventory->getArmor(2);
|
||||
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
|
||||
|
|
@ -271,8 +296,7 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
|
|||
{
|
||||
for(ModelPart *pModelPart : *pAdditionalModelParts)
|
||||
{
|
||||
shared_ptr<ItemInstance> itemInstance = mob->inventory->getArmor(3);
|
||||
if (itemInstance == nullptr || !pModelPart->hideWithHelmet)
|
||||
if (itemHelmet == nullptr || !pModelPart->hideWithHelmet) // Hide the skin boxes that have the hide when wearing a helmet
|
||||
pModelPart->visible=true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue