Skip to content

Commit

Permalink
Fix a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Jul 5, 2024
1 parent b0f34ef commit ee3299e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"gd": {
"win": "2.206"
},
"version": "v0.8.2",
"version": "v0.8.3",
"id": "zalphalaneous.minecraft",
"name": "Minecraftify!",
"developer": "Alphalaneous",
Expand Down
11 changes: 11 additions & 0 deletions src/ui/hooks/PlayLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ class $modify(MyPlayLayer, PlayLayer){

schedule(schedule_selector(MyPlayLayer::setFPS), 1);

if(CCLabelBMFont* debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID("debug-text"))) {
if(strcmp(debugText->getString(), "Ignore Damage") == 0){
debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID("percentage-label")); //hacky fix for wrong node IDs
}
debugText->setOpacity(0);
}

return true;
}

Expand All @@ -115,6 +122,10 @@ class $modify(MyPlayLayer, PlayLayer){
m_fields->rightDebugNode->removeAllChildren();

if(CCLabelBMFont* debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID("debug-text"))) {
if(strcmp(debugText->getString(), "Ignore Damage") == 0){
debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID("percentage-label")); //hacky fix for wrong node IDs
}

if(!debugText->isVisible()) return;

debugText->setOpacity(0);
Expand Down

0 comments on commit ee3299e

Please sign in to comment.