Fixed pony settings not going back to the ModMenu screen when opened from there

This commit is contained in:
Sollace 2019-07-16 17:52:39 +02:00
parent 7bff1f2625
commit ab3cd3f307
4 changed files with 12 additions and 11 deletions

View file

@ -113,7 +113,7 @@ public class MineLittlePony implements ClientModInitializer {
}
if ((mainMenu || inGame) && keyBinding.isPressed()) {
client.openScreen(new GuiPonySettings());
client.openScreen(new GuiPonySettings(client.currentScreen));
} else if (inGame) {
long handle = client.window.getHandle();
@ -149,7 +149,7 @@ public class MineLittlePony implements ClientModInitializer {
if (show) {
int y = hasHdSkins ? 75 : 50;
Button button = buttons.add(new Button(screen.width - 50, screen.height - y, 20, 20))
.onClick(sender -> MinecraftClient.getInstance().openScreen(new GuiPonySettings()));
.onClick(sender -> MinecraftClient.getInstance().openScreen(new GuiPonySettings(screen)));
button.getStyle()
.setIcon(new TextureSprite()
.setPosition(2, 2)

View file

@ -17,6 +17,8 @@ import com.minelittlepony.common.client.gui.element.Toggle;
import com.minelittlepony.common.util.settings.Setting;
import com.minelittlepony.settings.PonyLevel;
import javax.annotation.Nullable;
/**
* In-Game options menu.
*
@ -35,8 +37,8 @@ public class GuiPonySettings extends GameGui {
private final boolean hiddenOptions;
public GuiPonySettings() {
super(new LiteralText(OPTIONS_PREFIX + "title"));
public GuiPonySettings(@Nullable Screen parent) {
super(new LiteralText(OPTIONS_PREFIX + "title"), parent);
config = (ClientPonyConfig)MineLittlePony.getInstance().getConfig();
@ -72,7 +74,7 @@ public class GuiPonySettings extends GameGui {
addButton(new Label(width / 2, 5).setCentered()).getStyle().setText(getTitle().getString());
addButton(new Button(width / 2 - 100, height - 25))
.onClick(sender -> onClose())
.onClick(sender -> finish())
.getStyle()
.setText("gui.done");

View file

@ -5,18 +5,17 @@ import com.minelittlepony.common.client.gui.element.IconicToggle;
import com.minelittlepony.common.client.gui.style.Style;
import com.minelittlepony.hdskins.dummy.PlayerPreview;
import com.minelittlepony.hdskins.gui.GuiSkins;
import com.minelittlepony.hdskins.net.SkinServer;
import com.minelittlepony.hdskins.net.SkinServerList;
import com.minelittlepony.pony.IPonyManager;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundEvents;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import java.util.List;
/**
* Skin uploading GUI. Usually displayed over the main menu.
*/
@ -32,8 +31,8 @@ public class GuiSkinsMineLP extends GuiSkins {
"minelittlepony:textures/cubemap/sweetappleacres"
};
public GuiSkinsMineLP(List<SkinServer> servers) {
super(servers);
public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
super(parent, servers);
}
@Override

View file

@ -15,6 +15,6 @@ public class MineLPModMenuFactory implements ModMenuApi {
@Override
public Function<Screen, ? extends Screen> getConfigScreenFactory() {
return screen -> new GuiPonySettings();
return GuiPonySettings::new;
}
}