aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2022-09-26 00:29:41 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2022-09-26 00:29:41 -0700
commitcda06cf996cb8a0df2340b14b2a43d5a2a6ab13a (patch)
tree10b53d9f4f94e7b37253ee635c7942ce5360f656 /src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java
parent6d01463c32ea14f48ce273e9daf753905f101946 (diff)
downloadIceberg-cda06cf996cb8a0df2340b14b2a43d5a2a6ab13a.tar.gz
Iceberg-cda06cf996cb8a0df2340b14b2a43d5a2a6ab13a.tar.bz2
Iceberg-cda06cf996cb8a0df2340b14b2a43d5a2a6ab13a.zip
Added support for Configured 2.x.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java
deleted file mode 100644
index 9918740..0000000
--- a/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfiguredConfigHelperMixin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.anthonyhilyard.iceberg.mixin;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.anthonyhilyard.iceberg.config.IcebergConfigSpec;
-import com.electronwill.nightconfig.core.AbstractConfig;
-import com.electronwill.nightconfig.core.UnmodifiableConfig;
-
-
-import org.apache.commons.lang3.tuple.Pair;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import net.minecraftforge.common.ForgeConfigSpec;
-import net.minecraftforge.fml.config.ModConfig;
-
-
-import com.mrcrayfish.configured.util.ConfigHelper;
-
-
-@Mixin(ConfigHelper.class)
-public class ConfiguredConfigHelperMixin
-{
- @Inject(method = "gatherAllConfigValues(Lnet/minecraftforge/fml/config/ModConfig;)Ljava/util/List;",
- at = @At(value = "HEAD"), cancellable = true, remap = false, require = 0)
- private static void gatherAllConfigValuesIcebergSupport(ModConfig config, CallbackInfoReturnable<List<?>> info)
- {
- if (config.getSpec() instanceof IcebergConfigSpec icebergConfigSpec)
- {
- List<Pair<ForgeConfigSpec.ConfigValue<?>, ForgeConfigSpec.ValueSpec>> values = new ArrayList<>();
- gatherValuesFromIcebergConfig(icebergConfigSpec.getValues(), icebergConfigSpec, values);
- info.setReturnValue(values);
- }
- }
-
- private static void gatherValuesFromIcebergConfig(UnmodifiableConfig config, IcebergConfigSpec spec, List<Pair<ForgeConfigSpec.ConfigValue<?>, ForgeConfigSpec.ValueSpec>> values)
- {
- config.valueMap().forEach((s, o) ->
- {
- if (o instanceof AbstractConfig)
- {
- gatherValuesFromIcebergConfig((UnmodifiableConfig) o, spec, values);
- }
- else if (o instanceof ForgeConfigSpec.ConfigValue<?>)
- {
- ForgeConfigSpec.ConfigValue<?> configValue = (ForgeConfigSpec.ConfigValue<?>) o;
- ForgeConfigSpec.ValueSpec valueSpec = spec.getRaw(configValue.getPath());
- values.add(Pair.of(configValue, valueSpec));
- }
- });
- }
-} \ No newline at end of file