-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a21ed89
commit ad91575
Showing
9 changed files
with
123 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/brittank88/clipshot/client/gui/GuiConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.brittank88.clipshot.client.gui; | ||
|
||
import static com.brittank88.clipshot.config.ConfigurationHandler.*; | ||
|
||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraftforge.common.config.ConfigElement; | ||
import net.minecraftforge.common.config.Configuration; | ||
|
||
import com.brittank88.clipshot.ClipShot; | ||
|
||
public class GuiConfig extends cpw.mods.fml.client.config.GuiConfig { | ||
|
||
public GuiConfig(GuiScreen guiScreen) { | ||
super( | ||
guiScreen, | ||
new ConfigElement<>(getConfiguration().getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), | ||
ClipShot.MOD_ID, | ||
false, | ||
false, | ||
GuiConfig.getAbridgedConfigPath(getConfiguration().toString())); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/brittank88/clipshot/client/gui/GuiFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.brittank88.clipshot.client.gui; | ||
|
||
import java.util.Set; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.GuiScreen; | ||
|
||
import cpw.mods.fml.client.IModGuiFactory; | ||
|
||
@SuppressWarnings("unused") | ||
public class GuiFactory implements IModGuiFactory { | ||
|
||
@Override | ||
public void initialize(Minecraft minecraftInstance) { | ||
|
||
} | ||
|
||
@Override | ||
public Class<? extends GuiScreen> mainConfigGuiClass() { | ||
return GuiConfig.class; | ||
} | ||
|
||
@Override | ||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { | ||
return null; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/brittank88/clipshot/config/ConfigurationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.brittank88.clipshot.config; | ||
|
||
import java.io.File; | ||
|
||
import net.minecraftforge.common.config.Configuration; | ||
|
||
import com.brittank88.clipshot.ClipShot; | ||
|
||
import cpw.mods.fml.client.event.ConfigChangedEvent; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
|
||
public class ConfigurationHandler { | ||
|
||
public static Configuration configuration; | ||
|
||
// Initially acts as the default value, but will be updated from the configuration file. | ||
public static Boolean saveScreenshotsAsFiles = true; | ||
|
||
public static void init(File configFile) { | ||
if (configuration == null) { | ||
configuration = new Configuration(configFile); | ||
loadConfiguration(); | ||
} | ||
} | ||
|
||
private static void loadConfiguration() { | ||
saveScreenshotsAsFiles = configuration.getBoolean( | ||
"Save Screenshots as Files", | ||
Configuration.CATEGORY_GENERAL, | ||
saveScreenshotsAsFiles, | ||
"Determines if screenshots are also saved as files, or ONLY copied to the clipboard."); | ||
|
||
if (configuration.hasChanged()) configuration.save(); | ||
} | ||
|
||
@SubscribeEvent | ||
@SuppressWarnings("unused") | ||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { | ||
if (event.modID.equals(ClipShot.MOD_ID)) loadConfiguration(); | ||
} | ||
|
||
public static Configuration getConfiguration() { | ||
return configuration; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters