mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
fix(jui): call eXuiServerAction_PauseServer to pause server-side too
This commit is contained in:
parent
0fbbac1cde
commit
32fee4334d
|
|
@ -22,6 +22,11 @@ void PauseScreen::init() {
|
||||||
saveStep = 0;
|
saveStep = 0;
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
int yo = -16;
|
int yo = -16;
|
||||||
|
// 4jcraft: solves the issue of client-side only pausing in the java gui
|
||||||
|
if (g_NetworkManager.IsLocalGame() &&
|
||||||
|
g_NetworkManager.GetPlayerCount() == 1)
|
||||||
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||||
|
eXuiServerAction_PauseServer, (void*)TRUE);
|
||||||
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo,
|
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo,
|
||||||
L"Save and quit to title"));
|
L"Save and quit to title"));
|
||||||
if (minecraft->isClientSide()) {
|
if (minecraft->isClientSide()) {
|
||||||
|
|
@ -49,6 +54,15 @@ void PauseScreen::init() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PauseScreen::keyPressed(wchar_t eventCharacter, int eventKey) {
|
||||||
|
if (eventKey == Keyboard::KEY_ESCAPE && g_NetworkManager.IsLocalGame() &&
|
||||||
|
g_NetworkManager.GetPlayerCount() == 1)
|
||||||
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||||
|
eXuiServerAction_PauseServer, (void*)FALSE);
|
||||||
|
|
||||||
|
Screen::keyPressed(eventCharacter, eventKey);
|
||||||
|
}
|
||||||
|
|
||||||
void PauseScreen::exitWorld(Minecraft* minecraft, bool save) {
|
void PauseScreen::exitWorld(Minecraft* minecraft, bool save) {
|
||||||
// 4jcraft: made our own static method for use in the java gui (other
|
// 4jcraft: made our own static method for use in the java gui (other
|
||||||
// places such as the deathscreen need this)
|
// places such as the deathscreen need this)
|
||||||
|
|
@ -78,6 +92,8 @@ void PauseScreen::buttonClicked(Button* button) {
|
||||||
exitWorld(minecraft, true);
|
exitWorld(minecraft, true);
|
||||||
}
|
}
|
||||||
if (button->id == 4) {
|
if (button->id == 4) {
|
||||||
|
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||||
|
eXuiServerAction_PauseServer, (void*)FALSE);
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(NULL);
|
||||||
// minecraft->grabMouse(); // 4J - removed
|
// minecraft->grabMouse(); // 4J - removed
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ private:
|
||||||
public:
|
public:
|
||||||
PauseScreen(); // 4J added
|
PauseScreen(); // 4J added
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||||
static void exitWorld(Minecraft* minecraft, bool save);
|
static void exitWorld(Minecraft* minecraft, bool save);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue