-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from aratakileo/move-to-elegantia
Move to elegantia
- Loading branch information
Showing
46 changed files
with
527 additions
and
1,734 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs = -Xmx1G | ||
|
||
# Fabric Properties | ||
# check these on https://fabricmc.net/develop/ | ||
minecraft_version = 1.20.1 | ||
# General Properties | ||
# 1.20-1.20.1 | ||
#minecraft_version = 1.20.1 | ||
#loader_version = 0.14.25 | ||
#fabric_version = 0.83.0 | ||
#pack_format = 15 | ||
|
||
loader_version = 0.14.25 | ||
# 1.20.2-1.20.4 | ||
minecraft_version = 1.20.4 | ||
loader_version = 0.15.6 | ||
fabric_version = 0.96.0 | ||
pack_format = 22 | ||
|
||
quilt_loader = 0.23.1 | ||
|
||
# Mod Properties | ||
support_minecraft_versions = 1.20-1.20.1 | ||
mod_version = 1.0.1 | ||
# 1.20-1.20.1 | ||
#support_minecraft_versions = 1.20-1.20.1 | ||
# 1.20.2-1.20.4 | ||
support_minecraft_versions = 1.20.2-1.20.4 | ||
mod_version = 2.0.0 | ||
maven_group = io.github.aratakileo | ||
archives_base_name = emogg | ||
|
||
# Dependencies | ||
# check this on https://fabricmc.net/develop/ | ||
fabric_version = 0.83.0 | ||
modmenu_version = 7.2.2 | ||
suggestions_api_version = 1.0.4 | ||
suggestions_api_version = 1.0.6 | ||
elegantia_version=0.0.1-alpha |
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
77 changes: 20 additions & 57 deletions
77
src/main/java/io/github/aratakileo/emogg/EmoggConfig.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 |
---|---|---|
@@ -1,74 +1,37 @@ | ||
package io.github.aratakileo.emogg; | ||
|
||
import com.google.gson.FieldNamingPolicy; | ||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import io.github.aratakileo.elegantia.gui.config.Config; | ||
import io.github.aratakileo.elegantia.gui.config.ConfigField; | ||
import io.github.aratakileo.elegantia.gui.config.Trigger; | ||
import io.github.aratakileo.emogg.emoji.Emoji; | ||
import io.github.aratakileo.emogg.emoji.EmojiManager; | ||
import io.github.aratakileo.emogg.emoji.FueController; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.FileWriter; | ||
import java.util.ArrayList; | ||
|
||
public class EmoggConfig { | ||
// Non-JSON values | ||
private final static File file = new File("config/emogg.json"); | ||
private final static Gson gson = new GsonBuilder() | ||
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) | ||
.setPrettyPrinting() | ||
.create(); | ||
public class EmoggConfig extends Config { | ||
public static EmoggConfig instance; | ||
|
||
public static @NotNull EmoggConfig instance = new EmoggConfig(); | ||
|
||
// JSON values | ||
@Trigger("debug") | ||
@ConfigField | ||
public boolean enableDebugMode = false; | ||
@ConfigField(triggeredBy = "debug") | ||
public boolean enableAtlasDebugHUD = false; | ||
public @NotNull ArrayList<FueController.EmojiStatistic> frequentlyUsedEmojis = new ArrayList<>(); | ||
public @NotNull ArrayList<String> hiddenCategoryNames = new ArrayList<>(); | ||
public boolean enableCustomShaders = true; | ||
|
||
public static void setField(String field, Object value) { | ||
try { | ||
instance.getClass().getField(field).set(instance, value); | ||
} catch (IllegalAccessException | NoSuchFieldException e) { | ||
Emogg.LOGGER.warn("Failed to set config field "+field, e); | ||
} | ||
} | ||
|
||
public static Object getField(String field) { | ||
try { | ||
return instance.getClass().getField(field).get(instance); | ||
} catch (IllegalAccessException | NoSuchFieldException e) { | ||
Emogg.LOGGER.warn("Failed to get config field "+field, e); | ||
return null; | ||
} | ||
} | ||
public @NotNull ArrayList<FueController.EmojiStatistic> frequentlyUsedEmojis = new ArrayList<>(); | ||
public @NotNull ArrayList<String> hiddenCategoryNames = new ArrayList<>(); | ||
|
||
public static void load() { | ||
if (file.exists()) | ||
try { | ||
final var fileReader = new FileReader(file); | ||
instance = gson.fromJson(fileReader, EmoggConfig.class); | ||
fileReader.close(); | ||
} catch (Exception e) { | ||
Emogg.LOGGER.error("Failed to load emogg config: ", e); | ||
save(); | ||
} | ||
@ConfigField(triggeredBy = "debug") | ||
public static void reloadAllEmojis() { | ||
EmojiManager.getInstance().getEmojisStream() | ||
.forEach(e -> e.reload(false)); | ||
} | ||
|
||
public static void save() { | ||
final File parentFile; | ||
|
||
if (!(parentFile = file.getParentFile()).exists()) | ||
parentFile.mkdir(); | ||
|
||
try { | ||
final var fileWriter = new FileWriter(file); | ||
fileWriter.write(gson.toJson(instance)); | ||
fileWriter.close(); | ||
} catch (Exception e) { | ||
Emogg.LOGGER.error("Failed to save emogg config: ", e); | ||
} | ||
@ConfigField(triggeredBy = "debug") | ||
public static void forceLoadAllEmojis() { | ||
EmojiManager.getInstance().getEmojisStream() | ||
.forEach(Emoji::forceLoad); | ||
} | ||
} |
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
13 changes: 0 additions & 13 deletions
13
src/main/java/io/github/aratakileo/emogg/api/ModMenuApiImpl.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.