mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-12-01 16:27:59 +01:00
I finally got tired of this
This commit is contained in:
parent
ee16139876
commit
b5dfd57727
3 changed files with 30 additions and 10 deletions
|
@ -27,12 +27,25 @@ import java.util.List;
|
|||
@ExposableOptions(strategy = ConfigStrategy.Unversioned, filename = "hdskins")
|
||||
public class LiteModHDSkins implements InitCompleteListener, ViewportListener, Configurable, AdvancedExposable {
|
||||
|
||||
private static LiteModHDSkins instance;
|
||||
|
||||
public static LiteModHDSkins instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Expose
|
||||
public List<SkinServer> skin_servers = SkinServer.defaultServers;
|
||||
|
||||
@Expose
|
||||
public boolean experimentalSkinDrop = false;
|
||||
|
||||
@Expose
|
||||
public String lastChosenFile = "";
|
||||
|
||||
public LiteModHDSkins() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "HD Skins";
|
||||
|
@ -43,6 +56,10 @@ public class LiteModHDSkins implements InitCompleteListener, ViewportListener, C
|
|||
return "4.0.0";
|
||||
}
|
||||
|
||||
public void writeConfig() {
|
||||
LiteLoader.getInstance().writeConfig(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(File configPath) {
|
||||
|
||||
|
|
|
@ -3,24 +3,23 @@ package com.voxelmodpack.hdskins.gui;
|
|||
import com.minelittlepony.gui.Button;
|
||||
import com.minelittlepony.gui.Checkbox;
|
||||
import com.minelittlepony.gui.SettingsPanel;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
import com.voxelmodpack.hdskins.LiteModHDSkins;
|
||||
|
||||
public class HDSkinsConfigPanel extends SettingsPanel {
|
||||
@Override
|
||||
public void initGui() {
|
||||
final LiteModHDSkins mod = LiteLoader.getInstance().getMod(LiteModHDSkins.class);
|
||||
final LiteModHDSkins mod = LiteModHDSkins.instance();
|
||||
|
||||
addButton(new Button(40, 70, 100, 20, "hdskins.options.cache", sender ->{
|
||||
addButton(new Button(40, 70, 100, 20, "hdskins.options.cache", sender -> {
|
||||
HDSkinManager.INSTANCE.clearSkinCache();
|
||||
}));
|
||||
addButton(new Checkbox(40, 40, "hdskins.options.skindrops", mod.experimentalSkinDrop, checked -> {
|
||||
mod.experimentalSkinDrop = checked;
|
||||
|
||||
LiteLoader.getInstance().writeConfig(mod);
|
||||
mod.writeConfig();
|
||||
|
||||
if (mod.experimentalSkinDrop) {
|
||||
if (checked) {
|
||||
GLWindow.create();
|
||||
} else {
|
||||
GLWindow.dispose();
|
||||
|
|
|
@ -7,6 +7,10 @@ import java.io.File;
|
|||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
|
||||
import com.voxelmodpack.hdskins.LiteModHDSkins;
|
||||
|
||||
/**
|
||||
* Base class for "open file" dialog threads
|
||||
*
|
||||
|
@ -21,8 +25,6 @@ public abstract class ThreadOpenFile extends Thread {
|
|||
*/
|
||||
protected final IOpenFileCallback parentScreen;
|
||||
|
||||
private static String lastChosenFile = null;
|
||||
|
||||
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) throws IllegalStateException {
|
||||
if (minecraft.isFullScreen()) {
|
||||
throw new IllegalStateException("Cannot open an awt window whilst minecraft is in full screen mode!");
|
||||
|
@ -37,8 +39,9 @@ public abstract class ThreadOpenFile extends Thread {
|
|||
JFileChooser fileDialog = new JFileChooser();
|
||||
fileDialog.setDialogTitle(dialogTitle);
|
||||
|
||||
if (lastChosenFile != null) {
|
||||
fileDialog.setSelectedFile(new File(lastChosenFile));
|
||||
String last = LiteModHDSkins.instance().lastChosenFile;
|
||||
if (!Strings.isBlank(last)) {
|
||||
fileDialog.setSelectedFile(new File(last));
|
||||
}
|
||||
fileDialog.setFileFilter(getFileFilter());
|
||||
|
||||
|
@ -47,7 +50,8 @@ public abstract class ThreadOpenFile extends Thread {
|
|||
File f = fileDialog.getSelectedFile();
|
||||
|
||||
if (f != null) {
|
||||
lastChosenFile = f.getAbsolutePath();
|
||||
LiteModHDSkins.instance().lastChosenFile = f.getAbsolutePath();
|
||||
LiteModHDSkins.instance().writeConfig();
|
||||
}
|
||||
|
||||
parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult);
|
||||
|
|
Loading…
Reference in a new issue