mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 20:47:59 +01:00
Fixed pony settings not going back to the ModMenu screen when opened from there
This commit is contained in:
parent
7bff1f2625
commit
ab3cd3f307
4 changed files with 12 additions and 11 deletions
|
@ -113,7 +113,7 @@ public class MineLittlePony implements ClientModInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mainMenu || inGame) && keyBinding.isPressed()) {
|
if ((mainMenu || inGame) && keyBinding.isPressed()) {
|
||||||
client.openScreen(new GuiPonySettings());
|
client.openScreen(new GuiPonySettings(client.currentScreen));
|
||||||
} else if (inGame) {
|
} else if (inGame) {
|
||||||
long handle = client.window.getHandle();
|
long handle = client.window.getHandle();
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class MineLittlePony implements ClientModInitializer {
|
||||||
if (show) {
|
if (show) {
|
||||||
int y = hasHdSkins ? 75 : 50;
|
int y = hasHdSkins ? 75 : 50;
|
||||||
Button button = buttons.add(new Button(screen.width - 50, screen.height - y, 20, 20))
|
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()
|
button.getStyle()
|
||||||
.setIcon(new TextureSprite()
|
.setIcon(new TextureSprite()
|
||||||
.setPosition(2, 2)
|
.setPosition(2, 2)
|
||||||
|
|
|
@ -17,6 +17,8 @@ import com.minelittlepony.common.client.gui.element.Toggle;
|
||||||
import com.minelittlepony.common.util.settings.Setting;
|
import com.minelittlepony.common.util.settings.Setting;
|
||||||
import com.minelittlepony.settings.PonyLevel;
|
import com.minelittlepony.settings.PonyLevel;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In-Game options menu.
|
* In-Game options menu.
|
||||||
*
|
*
|
||||||
|
@ -35,8 +37,8 @@ public class GuiPonySettings extends GameGui {
|
||||||
|
|
||||||
private final boolean hiddenOptions;
|
private final boolean hiddenOptions;
|
||||||
|
|
||||||
public GuiPonySettings() {
|
public GuiPonySettings(@Nullable Screen parent) {
|
||||||
super(new LiteralText(OPTIONS_PREFIX + "title"));
|
super(new LiteralText(OPTIONS_PREFIX + "title"), parent);
|
||||||
|
|
||||||
config = (ClientPonyConfig)MineLittlePony.getInstance().getConfig();
|
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 Label(width / 2, 5).setCentered()).getStyle().setText(getTitle().getString());
|
||||||
addButton(new Button(width / 2 - 100, height - 25))
|
addButton(new Button(width / 2 - 100, height - 25))
|
||||||
.onClick(sender -> onClose())
|
.onClick(sender -> finish())
|
||||||
.getStyle()
|
.getStyle()
|
||||||
.setText("gui.done");
|
.setText("gui.done");
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,17 @@ import com.minelittlepony.common.client.gui.element.IconicToggle;
|
||||||
import com.minelittlepony.common.client.gui.style.Style;
|
import com.minelittlepony.common.client.gui.style.Style;
|
||||||
import com.minelittlepony.hdskins.dummy.PlayerPreview;
|
import com.minelittlepony.hdskins.dummy.PlayerPreview;
|
||||||
import com.minelittlepony.hdskins.gui.GuiSkins;
|
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.minelittlepony.pony.IPonyManager;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skin uploading GUI. Usually displayed over the main menu.
|
* Skin uploading GUI. Usually displayed over the main menu.
|
||||||
*/
|
*/
|
||||||
|
@ -32,8 +31,8 @@ public class GuiSkinsMineLP extends GuiSkins {
|
||||||
"minelittlepony:textures/cubemap/sweetappleacres"
|
"minelittlepony:textures/cubemap/sweetappleacres"
|
||||||
};
|
};
|
||||||
|
|
||||||
public GuiSkinsMineLP(List<SkinServer> servers) {
|
public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
|
||||||
super(servers);
|
super(parent, servers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,6 +15,6 @@ public class MineLPModMenuFactory implements ModMenuApi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Function<Screen, ? extends Screen> getConfigScreenFactory() {
|
public Function<Screen, ? extends Screen> getConfigScreenFactory() {
|
||||||
return screen -> new GuiPonySettings();
|
return GuiPonySettings::new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue