Skip to content

Commit

Permalink
update quilt-config version
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Aug 17, 2024
1 parent 52fe697 commit 0e4cdaf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ho.artisan.azusaconfig;

import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.injectables.annotations.PlatformOnly;

import java.nio.file.Path;
import java.util.List;
Expand All @@ -12,9 +13,10 @@ public static Path getConfigDirectory() {
throw new AssertionError();
}

// @ExpectPlatform
// public static <T> List<T> getEntrypoints(String key, Class<T> type) {
// // Just throw an error, the content should get replaced at runtime.
// throw new AssertionError();
// }
@PlatformOnly("fabric")
@ExpectPlatform
public static <T> List<T> getEntrypoints(String key, Class<T> type) {
// Just throw an error, the content should get replaced at runtime.
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
import java.util.LinkedHashMap;
import java.util.Map;

import dev.architectury.injectables.targets.ArchitecturyTarget;
import ho.artisan.azusaconfig.AzusaConfigExpectPlatform;
import ho.artisan.azusaconfig.AzusaConfigMod;
import org.quiltmc.config.api.ConfigEnvironment;

import org.quiltmc.config.api.Serializer;
import org.quiltmc.config.api.serializers.Json5Serializer;
import org.quiltmc.config.api.serializers.TomlSerializer;
import org.quiltmc.config.implementor_api.ConfigEnvironment;
import org.slf4j.Logger;

public final class AzusaConfigImpl {
Expand All @@ -43,13 +45,15 @@ public static void init() {
serializerMap.put("toml", TomlSerializer.INSTANCE);
serializerMap.put("json5", Json5Serializer.INSTANCE);

// for (Serializer serializer : AzusaConfigExpectPlatform.getEntrypoints("config_serializer", Serializer.class)) {
// Serializer oldValue = serializerMap.put(serializer.getFileExtension(), serializer);
//
// if (oldValue != null) {
// LOGGER.warn(AzusaConfigMod.MARKER, "Replacing {} serializer {} with {}", serializer.getFileExtension(), oldValue.getClass(), serializer.getClass());
// }
// }
if (ArchitecturyTarget.getCurrentTarget().equals("fabric")) {
for (Serializer serializer : AzusaConfigExpectPlatform.getEntrypoints("config_serializer", Serializer.class)) {
Serializer oldValue = serializerMap.put(serializer.getFileExtension(), serializer);

if (oldValue != null) {
LOGGER.warn(AzusaConfigMod.MARKER, "Replacing {} serializer {} with {}", serializer.getFileExtension(), oldValue.getClass(), serializer.getClass());
}
}
}

String globalConfigExtension = System.getProperty("azusaconfig.globalConfigExtension");
String defaultConfigExtension = System.getProperty("azusaconfig.defaultConfigExtension");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static Path getConfigDirectory() {
return FabricLoader.getInstance().getConfigDir();
}

// public static <T> List<T> getEntrypoints(String key, Class<T> type) {
// return FabricLoader.getInstance().getEntrypoints(key, type);
// }
public static <T> List<T> getEntrypoints(String key, Class<T> type) {
return FabricLoader.getInstance().getEntrypoints(key, type);
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enabled_platforms=fabric,neoforge
yarn_mappings=1.20.4+build.3

archives_base_name=AzusaConfig
mod_version=0.1.2
mod_version=0.1.3
maven_group=ho.artisan.azusaconfig

fabric_loader_version=0.15.2
Expand All @@ -15,5 +15,5 @@ neoforge_version=20.4.235
curseforge_id=970148
modrinth_id=12LahGY4

quiltconfig_version=1.3.1
quiltconfig_version=1.3.2
quiltparsers_version=0.2.0
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package ho.artisan.azusaconfig.neoforge;

//import ho.artisan.azusaconfig.neoforge.entrypoint.impl.EntrypointStorage;
import net.neoforged.fml.loading.FMLPaths;

import java.nio.file.Path;
import java.util.Collections;
import java.util.List;

public class AzusaConfigExpectPlatformImpl {
public static Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}

// public static <T> List<T> getEntrypoints(String key, Class<T> type) {
// return (List<T>) EntrypointStorage.getEntrypointContainers(key, type);
// }
public static <T> List<T> getEntrypoints(String key, Class<T> type) {
return Collections.emptyList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import ho.artisan.azusaconfig.AzusaConfigMod;
import ho.artisan.azusaconfig.impl.config.AzusaConfigImpl;
//import ho.artisan.azusaconfig.neoforge.entrypoint.impl.EntrypointStorage;
import net.neoforged.fml.IExtensionPoint;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
Expand All @@ -12,7 +11,6 @@ public class AzusaConfigModNeoForge {

public AzusaConfigModNeoForge() {
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (a, b) -> true));
// EntrypointStorage.loadAll();
AzusaConfigImpl.init();
}
}

0 comments on commit 0e4cdaf

Please sign in to comment.