Clean Up Code

This commit is contained in:
TheBrokenRail 2020-10-29 13:00:52 -04:00
parent 688ce20877
commit 48d796fa46

View File

@ -179,6 +179,10 @@ __attribute__((constructor)) static void init() {
patch((void *) 0x292fc, touch_gui_patch);
}
// Dyanmic Game Mode Switching
set_is_survival(1);
Minecraft_setIsCreativeMode_original = overwrite((void *) Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
// Get Default Game Mode
int default_game_mode;
if (is_server) {
@ -187,10 +191,6 @@ __attribute__((constructor)) static void init() {
default_game_mode = !extra_has_feature("Survival Mode");
}
// Dyanmic Game Mode Switching
set_is_survival(!default_game_mode);
Minecraft_setIsCreativeMode_original = overwrite((void *) Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
// Set Default Game Mode
unsigned char default_game_mode_patch[4] = {default_game_mode ? 0x01 : 0x00, 0x30, 0xa0, 0xe3};
patch((void *) 0x3d9b8, default_game_mode_patch);