mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Fix fatal bug where skins with no additional boxes would crash the game
This commit is contained in:
parent
c69c8eeee1
commit
77c235ee67
|
|
@ -522,13 +522,13 @@ void PlayerRenderer::renderHand()
|
||||||
|
|
||||||
|
|
||||||
//Render custom skin boxes on viewmodel - Botch
|
//Render custom skin boxes on viewmodel - Botch
|
||||||
vector<ModelPart*>* mdlprts = Minecraft::GetInstance()->player->GetAdditionalModelParts();
|
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;
|
vector<ModelPart*> armchildren = humanoidModel->arm0->children;
|
||||||
|
std::unordered_set<ModelPart*> additionalModelPartSet(additionalModelParts->begin(), additionalModelParts->end());
|
||||||
std::unordered_set<ModelPart*> mdlSet(mdlprts->begin(), mdlprts->end());
|
|
||||||
for (const auto& x : armchildren) {
|
for (const auto& x : armchildren) {
|
||||||
if (x) {
|
if (x) {
|
||||||
if (mdlSet.find(x) != mdlSet.end()) { //This is to verify box is still actually on current skin - Botch
|
if (additionalModelPartSet.find(x) != additionalModelPartSet.end()) { //This is to verify box is still actually on current skin - Botch
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
//We need to transform to match offset of arm - Botch
|
//We need to transform to match offset of arm - Botch
|
||||||
glTranslatef(-5 * 0.0625f, 2 * 0.0625f, 0);
|
glTranslatef(-5 * 0.0625f, 2 * 0.0625f, 0);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue