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,7 +127,11 @@ public class VFPScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
MinecraftClient.getInstance().setScreen(prevScreen);
|
||||
if (prevScreen instanceof VFPScreen vfpScreen) {
|
||||
vfpScreen.open(vfpScreen.prevScreen); // Support recursive opening
|
||||
} else {
|
||||
MinecraftClient.getInstance().setScreen(prevScreen);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,6 @@ import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.injection.access.ITextFieldWidget;
|
||||
import de.florianmichael.viafabricplus.save.impl.AccountsSave;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
@ -104,7 +103,7 @@ public class ClassiCubeLoginScreen extends VFPScreen {
|
||||
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
|
||||
ViaFabricPlus.global().getSaveManager().getAccountsSave().setClassicubeAccount(null);
|
||||
ProtocolSelectionScreen.INSTANCE.open(prevScreen);
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +63,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
}
|
||||
|
||||
public ClassiCubeServerListScreen() {
|
||||
super("ClassiCube ServerList", true);
|
||||
super("ClassiCube", true);
|
||||
|
||||
final var account = ViaFabricPlus.global().getSaveManager().getAccountsSave().getClassicubeAccount();
|
||||
if (account != null) {
|
||||
@ -84,11 +84,6 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
ProtocolSelectionScreen.INSTANCE.open(prevScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
|
Loading…
Reference in New Issue
Block a user