-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- move stuff, change package name (c -> C) - THIS IS A BREAKING CHANGE
- Loading branch information
Showing
133 changed files
with
5,065 additions
and
675 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
tab_width = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.gradle] | ||
indent_style = tab | ||
|
||
[*.java] | ||
indent_style = space | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[quilt.mod.json] | ||
indent_style = space | ||
tab_width = 2 | ||
|
||
[*.toml] | ||
indent_style = space | ||
tab_width = 2 | ||
|
||
[*.properties] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[.editorconfig] | ||
indent_style = space | ||
indent_size = 4 |
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,30 @@ | ||
*.java text eol=lf diff=java | ||
*.gradle text eol=lf diff=java | ||
*.kt text eol=lf diff=kotlin | ||
*.kts text eol=lf diff=kotlin | ||
gradlew text eol=lf | ||
*.bat text eol=crlf | ||
|
||
*.md text eol=lf diff=markdown | ||
|
||
.editorconfig text eol=lf | ||
|
||
*.json text eol=lf | ||
*.json5 text eol=lf | ||
*.properties text eol=lf | ||
*.toml text eol=lf | ||
*.xml text eol=lf diff=html | ||
|
||
# Modding specific | ||
*.accesswidener text eol=lf | ||
|
||
# These files are binary and should be left untouched | ||
# (binary is a macro for -text -diff) | ||
*.class binary | ||
*.dll binary | ||
*.ear binary | ||
*.jar binary | ||
*.jks binary | ||
*.png binary | ||
*.so binary | ||
*.war binary |
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,29 +1,34 @@ | ||
# gradle | ||
# Gradle | ||
.gradle/ | ||
build/ | ||
out/ | ||
classes/ | ||
|
||
# eclipse | ||
# Quilt Loom | ||
remappedSrc/ | ||
run/ | ||
|
||
# Eclipse | ||
*.launch | ||
|
||
# idea | ||
# IntelliJ Idea | ||
.idea/ | ||
*.iml | ||
*.ipr | ||
*.iws | ||
|
||
# vscode | ||
# Fleet | ||
.fleet/ | ||
|
||
# Visual Studio Code | ||
.settings/ | ||
.vscode/ | ||
bin/ | ||
.classpath | ||
.project | ||
|
||
# fabric | ||
run/ | ||
# Eclipse JDT LS | ||
workspace/ | ||
|
||
# macos | ||
# macOS | ||
*.DS_Store | ||
src/main/resources/assets/minecraft/textures/entity/alex.png | ||
src/main/resources/assets/minecraft/textures/entity/steve.png |
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,68 @@ | ||
plugins { | ||
id 'java' | ||
id "org.quiltmc.loom" version "1.0.+" | ||
} | ||
|
||
group = maven_group | ||
version = "${project.version}+${project.minecraft_119}" | ||
archivesBaseName = "AxolotlClient-config" | ||
|
||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
|
||
repositories { | ||
maven { | ||
url = "https://moehreag.duckdns.org/maven/releases" | ||
} | ||
maven { | ||
url = "https://maven.terraformersmc.com/releases" | ||
} | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${project.minecraft_119}" | ||
mappings "org.quiltmc:quilt-mappings:${project.mappings_119}:intermediary-v2" | ||
|
||
modImplementation "org.quiltmc:quilt-loader:${project.quilt_loader}" | ||
|
||
modApi include("org.quiltmc.qsl.core:lifecycle_events:${project.qsl}") | ||
modApi include("org.quiltmc.qsl.management:client_command:${project.qsl}") | ||
|
||
modApi("com.terraformersmc:modmenu:5.0.2") | ||
|
||
implementation include(project(":common")) | ||
} | ||
|
||
processResources { | ||
inputs.property 'version', version | ||
|
||
filesMatching('quilt.mod.json') { | ||
expand "version": version | ||
} | ||
} | ||
|
||
runClient { | ||
classpath(sourceSets.test.runtimeClasspath) | ||
} | ||
|
||
// Configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifactId = archivesBaseName | ||
from components.java | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "owlMaven" | ||
def repository = project.version.toString().contains("beta") || project.version.toString().contains("alpha") ? "snapshots" : "releases" | ||
url = "https://moehreag.duckdns.org/maven/"+repository | ||
credentials(PasswordCredentials) | ||
authentication { | ||
basic(BasicAuthentication) | ||
} | ||
} | ||
} | ||
} |
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,14 @@ | ||
pluginManagement { | ||
repositories { | ||
maven { | ||
name = 'Quilt' | ||
url = 'https://maven.quiltmc.org/repository/release' | ||
} | ||
// Currently needed for Intermediary and other temporary dependencies | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
gradlePluginPortal() | ||
} | ||
} |
11 changes: 6 additions & 5 deletions
11
...ientConfig/AxolotlClientConfigConfig.java → ...ientConfig/AxolotlClientConfigConfig.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
137 changes: 137 additions & 0 deletions
137
...src/main/java/io/github/axolotlclient/AxolotlClientConfig/AxolotlClientConfigManager.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,137 @@ | ||
package io.github.axolotlclient.AxolotlClientConfig; | ||
|
||
import io.github.axolotlclient.AxolotlClientConfig.common.ConfigHolder; | ||
import io.github.axolotlclient.AxolotlClientConfig.common.ConfigManager; | ||
import io.github.axolotlclient.AxolotlClientConfig.common.Translations; | ||
import io.github.axolotlclient.AxolotlClientConfig.options.OptionCategory; | ||
import io.github.axolotlclient.AxolotlClientConfig.screen.OptionsScreenBuilder; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
public class AxolotlClientConfigManager extends io.github.axolotlclient.AxolotlClientConfig.common.AxolotlClientConfigManager { | ||
private static final HashMap<String, ConfigHolder> configs = new HashMap<>(); | ||
private static final HashMap<String, ConfigManager> managers = new HashMap<>(); | ||
private static final HashMap<String, List<String>> ignoredNames = new HashMap<>(); | ||
|
||
public static Logger LOGGER = LogManager.getLogger("AxolotlClient Config"); | ||
|
||
private static final AxolotlClientConfigManager Instance = new AxolotlClientConfigManager(); | ||
private AxolotlClientConfigManager(){} | ||
|
||
public static AxolotlClientConfigManager getInstance(){ | ||
return Instance; | ||
} | ||
|
||
@ApiStatus.Internal | ||
public static final String MODID = "axolotlclientconfig"; | ||
|
||
/** | ||
* Call one of these two methods when registering a mod config. | ||
* @param modid your modid. | ||
* @param config an instance of your config class, extending ConfigHolder. | ||
* @param manager Your config manager. Can be omitted or null when the {@link DefaultConfigManager} should be used. | ||
*/ | ||
public void registerConfig(String modid, ConfigHolder config, @Nullable ConfigManager manager){ | ||
configs.put(modid, config); | ||
|
||
if(manager == null){ | ||
manager = new DefaultConfigManager(modid); | ||
} | ||
|
||
managers.put(modid, manager); | ||
|
||
manager.load(); | ||
} | ||
|
||
public void registerConfig(String modid, ConfigHolder config){ | ||
registerConfig(modid, config, null); | ||
} | ||
|
||
/** | ||
* Opens a config screen for the provided modid. | ||
* @param modid the modid the config screen should be opened for. | ||
*/ | ||
public void openConfigScreen(String modid){ | ||
MinecraftClient.getInstance().setScreen(getConfigScreen(modid, MinecraftClient.getInstance().currentScreen)); | ||
} | ||
|
||
/** | ||
* Gets the built config screen for a mod. | ||
* @param modid the mod of which the config screen should be built | ||
* @param parent the parent screen | ||
* @return the built screen | ||
*/ | ||
public Screen getConfigScreen(String modid, Screen parent){ | ||
return new OptionsScreenBuilder(parent, | ||
(OptionCategory) (configs.get(modid).getCategories().size() == 1 ? configs.get(modid).getCategories().get(0) : | ||
new OptionCategory(modid, false).addSubCategories(configs.get(modid).getCategories())), modid); | ||
} | ||
|
||
@ApiStatus.Internal | ||
public ConfigHolder getModConfig(String modid){ | ||
if(modid.equals(MODID)){ | ||
return ConfigHolder.EMPTY; | ||
} | ||
return configs.get(modid); | ||
} | ||
|
||
/** | ||
* Add a string to the list of ignored options for a specific mod | ||
* @param modid The mod's id. | ||
* @param id The option's (untranslated) name. | ||
*/ | ||
public void addIgnoredName(String modid, String id){ | ||
ignoredNames.computeIfAbsent(modid, k -> new ArrayList<>()).add(id); | ||
} | ||
|
||
@ApiStatus.Internal | ||
public List<String> getIgnoredNames(String modid){ | ||
return ignoredNames.computeIfAbsent(modid, k -> new ArrayList<>()); | ||
} | ||
|
||
/** | ||
* Save the config for the provided modid | ||
* @param modid The modid whichs config should be saved. | ||
*/ | ||
|
||
public void save(String modid) { | ||
if(modid.equals(MODID)){ | ||
return; | ||
} | ||
managers.get(modid).save(); | ||
} | ||
|
||
/** | ||
* Load a config into their options. | ||
* @param modid The modid whichs config should be loaded. | ||
*/ | ||
|
||
public void load(String modid) { | ||
managers.get(modid).load(); | ||
} | ||
|
||
@ApiStatus.Internal | ||
public void saveCurrentConfig(){ | ||
if(MinecraftClient.getInstance().currentScreen instanceof OptionsScreenBuilder){ | ||
save(((OptionsScreenBuilder) MinecraftClient.getInstance().currentScreen).modid); | ||
} | ||
} | ||
|
||
@ApiStatus.Internal | ||
public HashMap<String, ConfigHolder> getConfigs(){ | ||
return configs; | ||
} | ||
|
||
@Override | ||
public Translations getTranslations() { | ||
return TranslationProvider.getInstance(); | ||
} | ||
} |
Oops, something went wrong.