Fix Creative Mode In Dedicated Server
All checks were successful
minecraft-pi-docker/pipeline/head This commit looks good
All checks were successful
minecraft-pi-docker/pipeline/head This commit looks good
This commit is contained in:
parent
b762fdadef
commit
55c789dab2
@ -189,19 +189,16 @@ __attribute__((constructor)) static void init() {
|
|||||||
Minecraft_setIsCreativeMode_original = overwrite((void *) Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
|
Minecraft_setIsCreativeMode_original = overwrite((void *) Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
|
||||||
|
|
||||||
// Get Default Game Mode
|
// Get Default Game Mode
|
||||||
int default_game_mode;
|
if (!is_server) {
|
||||||
if (is_server) {
|
int default_game_mode = !extra_has_feature("Survival Mode");
|
||||||
default_game_mode = server_get_default_game_mode();
|
|
||||||
} else {
|
|
||||||
default_game_mode = !extra_has_feature("Survival Mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Default Game Mode
|
// Set Default Game Mode
|
||||||
unsigned char default_game_mode_patch[4] = {default_game_mode ? 0x01 : 0x00, 0x30, 0xa0, 0xe3};
|
unsigned char default_game_mode_patch[4] = {default_game_mode ? 0x01 : 0x00, 0x30, 0xa0, 0xe3};
|
||||||
patch((void *) 0x3d9b8, default_game_mode_patch);
|
patch((void *) 0x3d9b8, default_game_mode_patch);
|
||||||
patch((void *) 0x38a78, default_game_mode_patch);
|
patch((void *) 0x38a78, default_game_mode_patch);
|
||||||
|
}
|
||||||
|
|
||||||
// Disable Item Dropping When Cursor Is Hidden
|
// Disable Item Dropping Using The Cursor When Cursor Is Hidden
|
||||||
Gui_tickItemDrop_original = overwrite((void *) Gui_tickItemDrop, Gui_tickItemDrop_injection);
|
Gui_tickItemDrop_original = overwrite((void *) Gui_tickItemDrop, Gui_tickItemDrop_injection);
|
||||||
// Disable Opening Inventory Using The Cursor When Cursor Is Hidden
|
// Disable Opening Inventory Using The Cursor When Cursor Is Hidden
|
||||||
Gui_handleClick_original = overwrite((void *) Gui_handleClick, Gui_handleClick_injection);
|
Gui_handleClick_original = overwrite((void *) Gui_handleClick, Gui_handleClick_injection);
|
||||||
|
@ -115,7 +115,7 @@ static void Minecraft_update_injection(unsigned char *minecraft) {
|
|||||||
INFO("%s", "Starting Minecraft: Pi Edition Dedicated Server");
|
INFO("%s", "Starting Minecraft: Pi Edition Dedicated Server");
|
||||||
|
|
||||||
LevelSettings settings;
|
LevelSettings settings;
|
||||||
settings.game_type = 0; // Patched By MCPI-Docker
|
settings.game_type = get_server_properties().get_int("game-mode", DEFAULT_GAME_MODE);;
|
||||||
std::string seed_str = get_server_properties().get_string("seed", DEFAULT_SEED);
|
std::string seed_str = get_server_properties().get_string("seed", DEFAULT_SEED);
|
||||||
int32_t seed = seed_str.length() > 0 ? std::stoi(seed_str) : time(NULL);
|
int32_t seed = seed_str.length() > 0 ? std::stoi(seed_str) : time(NULL);
|
||||||
settings.seed = seed;
|
settings.seed = seed;
|
||||||
@ -232,9 +232,6 @@ static void exit_handler(__attribute__((unused)) int data) {
|
|||||||
const char *server_get_motd() {
|
const char *server_get_motd() {
|
||||||
return get_server_properties().get_string("motd", DEFAULT_MOTD).c_str();
|
return get_server_properties().get_string("motd", DEFAULT_MOTD).c_str();
|
||||||
}
|
}
|
||||||
int server_get_default_game_mode() {
|
|
||||||
return get_server_properties().get_int("game-mode", DEFAULT_GAME_MODE);
|
|
||||||
}
|
|
||||||
int server_get_mob_spawning() {
|
int server_get_mob_spawning() {
|
||||||
return get_server_properties().get_bool("spawn-mobs", DEFAULT_MOB_SPAWNING);
|
return get_server_properties().get_bool("spawn-mobs", DEFAULT_MOB_SPAWNING);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ extern "C" {
|
|||||||
void server_init();
|
void server_init();
|
||||||
|
|
||||||
const char *server_get_motd();
|
const char *server_get_motd();
|
||||||
int server_get_default_game_mode();
|
|
||||||
int server_get_mob_spawning();
|
int server_get_mob_spawning();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user