From ee3299e583b508afb9ec7330688db38345dd65bb Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:15:33 -0400 Subject: [PATCH] Fix a crash --- mod.json | 2 +- src/ui/hooks/PlayLayer.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mod.json b/mod.json index c58113d..71cfc46 100644 --- a/mod.json +++ b/mod.json @@ -3,7 +3,7 @@ "gd": { "win": "2.206" }, - "version": "v0.8.2", + "version": "v0.8.3", "id": "zalphalaneous.minecraft", "name": "Minecraftify!", "developer": "Alphalaneous", diff --git a/src/ui/hooks/PlayLayer.h b/src/ui/hooks/PlayLayer.h index b1f9318..b1d2149 100644 --- a/src/ui/hooks/PlayLayer.h +++ b/src/ui/hooks/PlayLayer.h @@ -107,6 +107,13 @@ class $modify(MyPlayLayer, PlayLayer){ schedule(schedule_selector(MyPlayLayer::setFPS), 1); + if(CCLabelBMFont* debugText = typeinfo_cast(getChildByID("debug-text"))) { + if(strcmp(debugText->getString(), "Ignore Damage") == 0){ + debugText = typeinfo_cast(getChildByID("percentage-label")); //hacky fix for wrong node IDs + } + debugText->setOpacity(0); + } + return true; } @@ -115,6 +122,10 @@ class $modify(MyPlayLayer, PlayLayer){ m_fields->rightDebugNode->removeAllChildren(); if(CCLabelBMFont* debugText = typeinfo_cast(getChildByID("debug-text"))) { + if(strcmp(debugText->getString(), "Ignore Damage") == 0){ + debugText = typeinfo_cast(getChildByID("percentage-label")); //hacky fix for wrong node IDs + } + if(!debugText->isVisible()) return; debugText->setOpacity(0);