Skip to content

Commit 294e547

Browse files
committed
Merge newer commits from PR MCLCE#1453
2 parents 1c73f2e + 24c74aa commit 294e547

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

Minecraft.Client/HumanoidModel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox)
109109
pNewBox = new ModelPart(this, static_cast<int>(pBox->fU), static_cast<int>(pBox->fV));
110110
pNewBox->visible=false;
111111
if (pBox->fM > 0) pNewBox->bMirror = true; // check if this box has the mirror flag
112+
if (pBox->fA > 0) pNewBox->hideWithHelmet = true; // check if this box has the "hide when helmet" is worn flag
112113
pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, scale);
113114
// 4J-PB - don't compile here, since the lighting isn't set up. It'll be compiled on first use.
114115
//pNewBox->compile(1.0f/16.0f);

Minecraft.Client/ModelPart.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ void ModelPart::_init()
1313
compiled=false;
1414
bMirror = false;
1515
visible = true;
16+
hideWithHelmet = false;
1617
neverRender = false;
1718
x=y=z = 0.0f;
1819
xRot=yRot=zRot = 0.0f;

Minecraft.Client/ModelPart.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ModelPart
1616
float xRot, yRot, zRot;
1717
bool bMirror;
1818
bool visible;
19+
bool hideWithHelmet;
1920
bool neverRender;
2021
vector <Cube *> cubes;
2122
vector <ModelPart *> children;

Minecraft.Client/PlayerRenderer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
258258
{
259259
for(ModelPart *pModelPart : *pAdditionalModelParts)
260260
{
261-
pModelPart->visible=true;
261+
shared_ptr<ItemInstance> itemInstance = mob->inventory->getArmor(3);
262+
if (itemInstance == nullptr || !pModelPart->hideWithHelmet)
263+
pModelPart->visible=true;
262264
}
263265
}
264266

0 commit comments

Comments
 (0)