mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
Rewrote close handling of VFPScreen to support recursive opening
This commit is contained in:
parent
f61cb8b8f6
commit
1c206b83e0
@ -127,8 +127,12 @@ public class VFPScreen extends Screen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
if (prevScreen instanceof VFPScreen vfpScreen) {
|
||||||
|
vfpScreen.open(vfpScreen.prevScreen); // Support recursive opening
|
||||||
|
} else {
|
||||||
MinecraftClient.getInstance().setScreen(prevScreen);
|
MinecraftClient.getInstance().setScreen(prevScreen);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the ViaFabricPlus title
|
* Renders the ViaFabricPlus title
|
||||||
|
@ -27,7 +27,6 @@ import de.florianmichael.viafabricplus.ViaFabricPlus;
|
|||||||
import de.florianmichael.viafabricplus.injection.access.ITextFieldWidget;
|
import de.florianmichael.viafabricplus.injection.access.ITextFieldWidget;
|
||||||
import de.florianmichael.viafabricplus.save.impl.AccountsSave;
|
import de.florianmichael.viafabricplus.save.impl.AccountsSave;
|
||||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||||
import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
|
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
@ -104,7 +103,7 @@ public class ClassiCubeLoginScreen extends VFPScreen {
|
|||||||
public void close() {
|
public void close() {
|
||||||
// The user wasn't logged in when opening this screen, so he cancelled the login process, so we can safely unset the account
|
// The user wasn't logged in when opening this screen, so he cancelled the login process, so we can safely unset the account
|
||||||
ViaFabricPlus.global().getSaveManager().getAccountsSave().setClassicubeAccount(null);
|
ViaFabricPlus.global().getSaveManager().getAccountsSave().setClassicubeAccount(null);
|
||||||
ProtocolSelectionScreen.INSTANCE.open(prevScreen);
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,7 +63,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ClassiCubeServerListScreen() {
|
public ClassiCubeServerListScreen() {
|
||||||
super("ClassiCube ServerList", true);
|
super("ClassiCube", true);
|
||||||
|
|
||||||
final var account = ViaFabricPlus.global().getSaveManager().getAccountsSave().getClassicubeAccount();
|
final var account = ViaFabricPlus.global().getSaveManager().getAccountsSave().getClassicubeAccount();
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
@ -84,11 +84,6 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
|||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
ProtocolSelectionScreen.INSTANCE.open(prevScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
this.renderBackground(context, mouseX, mouseY, delta);
|
this.renderBackground(context, mouseX, mouseY, delta);
|
||||||
|
Loading…
Reference in New Issue
Block a user