diff options
author | Anthony Hilyard <anthony.hilyard@gmail.com> | 2022-06-14 22:24:22 -0700 |
---|---|---|
committer | Anthony Hilyard <anthony.hilyard@gmail.com> | 2022-06-14 22:24:22 -0700 |
commit | ee81f0ac1cb848609a755a875f5df0f5d51fa881 (patch) | |
tree | 76522b793e92f971f324be7935710c4b3b59ba1f /src/main/java/com/anthonyhilyard/iceberg/mixin/ConfigMenusForgeIEntryDataMixin.java | |
parent | 15a3b944d13e54f4241df78b199403d414b9bd69 (diff) | |
download | Iceberg-ee81f0ac1cb848609a755a875f5df0f5d51fa881.tar.gz Iceberg-ee81f0ac1cb848609a755a875f5df0f5d51fa881.tar.bz2 Iceberg-ee81f0ac1cb848609a755a875f5df0f5d51fa881.zip |
Initial port to 1.19.
Disabled Config Menus for Forge support until it has a 1.19 version.
Disabled AutoRegistry since Forge broke it.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/ConfigMenusForgeIEntryDataMixin.java')
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/mixin/ConfigMenusForgeIEntryDataMixin.java | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfigMenusForgeIEntryDataMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfigMenusForgeIEntryDataMixin.java deleted file mode 100644 index 9bd54f6..0000000 --- a/src/main/java/com/anthonyhilyard/iceberg/mixin/ConfigMenusForgeIEntryDataMixin.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.anthonyhilyard.iceberg.mixin; - -import java.util.Map; - -import com.anthonyhilyard.iceberg.util.ConfigMenusForgeHelper; -import com.electronwill.nightconfig.core.UnmodifiableConfig; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -import fuzs.configmenusforge.client.gui.data.IEntryData; -import net.minecraftforge.fml.config.IConfigSpec; -import net.minecraftforge.fml.config.ModConfig; - -@Mixin(IEntryData.class) -public interface ConfigMenusForgeIEntryDataMixin -{ - /** - * @author Iceberg - * @reason Overwriting makeValueToDataMap to allow classes other than ForgeConfigSpec to be supported. - */ - @Overwrite(remap = false) - public static Map<Object, IEntryData> makeValueToDataMap(ModConfig config) - { - if (checkInvalid(config)) - { - return ImmutableMap.of(); - } - Map<Object, IEntryData> allData = Maps.newHashMap(); - UnmodifiableConfig spec = config.getSpec(); - ConfigMenusForgeHelper.makeValueToDataMap(spec, ConfigMenusForgeHelper.getValues(spec), config.getConfigData(), allData, ""); - return ImmutableMap.copyOf(allData); - } - - /** - * @author Iceberg - * @reason Overwriting checkInvalid to allow classes other than ForgeConfigSpec to be supported. - */ - @Overwrite(remap = false) - public static boolean checkInvalid(ModConfig config) - { - IConfigSpec<?> spec = config.getSpec(); - - // True / false means the config class has been cached, null means it's new. - Boolean cachedValue = ConfigMenusForgeHelper.cachedValidity(spec.getClass()); - if (cachedValue == null) - { - // It's not cached, so do the lookup via MethodHandles API and cache the results. - ConfigMenusForgeHelper.cacheClass(spec.getClass()); - } - - return config.getConfigData() == null || !ConfigMenusForgeHelper.cachedValidity(spec.getClass()) || !ConfigMenusForgeHelper.isLoaded(spec); - } -} |