Skip to content

Commit bc63b18

Browse files
committed
Bug fixes and crash fix
1 parent 1098f3d commit bc63b18

File tree

4 files changed

+47
-20
lines changed

4 files changed

+47
-20
lines changed

mod.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"geode": "3.1.1",
2+
"geode": "3.2.0",
33
"gd": {
44
"win": "2.206"
55
},
6-
"version": "v0.8.7",
6+
"version": "v0.8.8",
77
"id": "zalphalaneous.minecraft",
88
"name": "Minecraftify!",
99
"developer": "Alphalaneous",
@@ -21,5 +21,12 @@
2121
"assets/shaders/blur/*",
2222
"assets/logo.ico"
2323
]
24-
}
24+
},
25+
"dependencies": [
26+
{
27+
"id": "geode.node-ids",
28+
"version": ">=v1.12.0-alpha.2",
29+
"importance": "required"
30+
}
31+
]
2532
}

src/ui/hooks/MenuLayer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class $modify(MenuLayer){
3232
}
3333
rightSideMenu->setContentSize({170, 70});
3434
rightSideMenu->setUserObject("orientation", CCInteger::create(1));
35+
rightSideMenu->removeChildByID("daily-chest-button");
36+
3537
}
3638
}
3739

src/ui/hooks/PlayLayer.h

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class $modify(MyPlayLayer, PlayLayer){
2626
return false;
2727
}
2828

29+
if(!Loader::get()->isModLoaded("geode.node-ids")) return true;
30+
2931
CCConfiguration* config = CCConfiguration::sharedConfiguration();
3032
CCDictionary* dict = public_cast(config, m_pValueDict);
3133

@@ -93,7 +95,7 @@ class $modify(MyPlayLayer, PlayLayer){
9395
addChild(m_fields->leftDebugNode);
9496
addChild(m_fields->rightDebugNode);
9597

96-
schedule(schedule_selector(MyPlayLayer::updateDebugLabels));
98+
schedule(schedule_selector(MyPlayLayer::updateDebugLabels), 1/60);
9799
setFPS(0);
98100
schedule(schedule_selector(MyPlayLayer::setFPS), 1);
99101

@@ -106,15 +108,14 @@ class $modify(MyPlayLayer, PlayLayer){
106108
if(CCLabelBMFont* debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID("debug-text"))) {
107109
m_fields->debugText = debugText;
108110

109-
if(strcmp(debugText->getString(), "Ignore Damage") == 0) { //hacky fix for wrong node IDs
111+
if(strcmp(debugText->getString(), "Ignore Damage") == 0 || strcmp(debugText->getString(), "Testmode") == 0) { //hacky fix for wrong node IDs
110112
if(CCNode* node = getChildByID("percentage-label")){
111113
m_fields->debugText = typeinfo_cast<CCLabelBMFont*>(node);
112114
}
113115
else if(CCNode* node = getChildByID("time-label")){
114116
m_fields->debugText = typeinfo_cast<CCLabelBMFont*>(node);
115117
}
116118
}
117-
118119
m_fields->debugText->setOpacity(0);
119120
}
120121
}
@@ -233,25 +234,36 @@ class $modify(MyPlayLayer, PlayLayer){
233234

234235
std::string getFromPos(int pos, std::vector<std::string> values){
235236

236-
std::string value = values.at(pos);
237-
std::string splitValue = Utils::splitString(value, ":").at(1);
238-
Utils::trim(splitValue);
237+
std::string ret = "";
238+
239+
if(pos < values.size()){
240+
241+
std::string value = values.at(pos);
242+
std::vector<std::string> splitValue = Utils::splitString(value, ":");
239243

240-
return splitValue;
244+
if(splitValue.size() > 0){
245+
ret = splitValue.at(1);
246+
}
247+
Utils::trim(ret);
248+
}
249+
return ret;
241250
}
242251
};
243252

244253
class $modify(MyCCKeyboardDispatcher, CCKeyboardDispatcher) {
245254

246255
bool dispatchKeyboardMSG(enumKeyCodes key, bool down, bool arr) {
247256

248-
if(MyPlayLayer* playLayer = static_cast<MyPlayLayer*>(PlayLayer::get())){
249-
if(key == KEY_F3 && down && !arr){
250-
GameManager* gm = GameManager::get();
251-
if(playLayer->m_fields->debugText){
252-
bool isVisible = playLayer->m_fields->debugText->isVisible();
253-
playLayer->m_fields->debugText->setVisible(!isVisible);
254-
gm->setGameVariable("0109", !isVisible);
257+
if(Loader::get()->isModLoaded("geode.node-ids")) {
258+
259+
if(MyPlayLayer* playLayer = static_cast<MyPlayLayer*>(PlayLayer::get())){
260+
if(key == KEY_F3 && down && !arr){
261+
GameManager* gm = GameManager::get();
262+
if(playLayer->m_fields->debugText){
263+
bool isVisible = playLayer->m_fields->debugText->isVisible();
264+
playLayer->m_fields->debugText->setVisible(!isVisible);
265+
gm->setGameVariable("0109", !isVisible);
266+
}
255267
}
256268
}
257269
}

src/ui/layers/ExtrasLayer.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,25 @@ bool ExtrasLayer::init() {
2929
CCMenu* rightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("right-side-menu"));
3030
rightMenu->setPosition({winSize.width/2, 150});
3131
rightMenu->setVisible(true);
32-
rightMenu->removeFromParent();
32+
rightMenu->removeFromParentAndCleanup(false);
33+
34+
CCMenu* pagedRightMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("paged-right-side-menu"));
3335

3436
this->addChild(rightMenu);
37+
this->addChild(pagedRightMenu);
3538

3639
m_bottomMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("bottom-menu"));
3740

3841
m_bottomMenu->setID("extras-menu"_spr);
3942
m_bottomMenu->setPosition({winSize.width/2, 100});
4043
m_bottomMenu->setVisible(true);
41-
m_bottomMenu->setScale(0.8f);
42-
m_bottomMenu->removeFromParent();
44+
m_bottomMenu->removeFromParentAndCleanup(false);
45+
46+
CCMenu* pagedBottomtMenu = typeinfo_cast<CCMenu*>(m_menuLayer->getChildByID("paged-bottom-menu"));
4347

4448
this->addChild(m_bottomMenu);
49+
this->addChild(pagedBottomtMenu);
50+
4551
}
4652
else{
4753

0 commit comments

Comments
 (0)