AutoConfig can't read ModifierKeyCode from config
MrMasrozYTLIVE opened this issue ยท 1 comments
Whenever I try to use ModifierKeyCode(Impl) in my config it just fails to read it:
me.shedaniel.autoconfig.serializer.ConfigSerializer$SerializationException: com.google.gson.JsonIOException: Interfaces can't be instantiated! Register an InstanceCreator or a TypeAdapter for this type. Interface name: java.util.function.Supplier
at me.shedaniel.autoconfig.serializer.GsonConfigSerializer.deserialize(GsonConfigSerializer.java:83) ~[cloth-config-fabric-15.0.128-fabric.jar:?]
at me.shedaniel.autoconfig.ConfigManager.load(ConfigManager.java:92) ~[cloth-config-fabric-15.0.128-fabric.jar:?]
at me.shedaniel.autoconfig.ConfigManager.<init>(ConfigManager.java:53) ~[cloth-config-fabric-15.0.128-fabric.jar:?]
at me.shedaniel.autoconfig.AutoConfig.register(AutoConfig.java:66) ~[cloth-config-fabric-15.0.128-fabric.jar:?]
It only happens when launched in IDE though
Forgot to mention, this is how I register type:
AutoConfig.getGuiRegistry(ModConfig.class).registerTypeProvider((i18n, field, config, defaults, registry) -> {
Point point = (Point) config;
ModifierKeyCodeImpl keyCode = Utils.getUnsafely(field, point, CTPMod.DEFAULT_KEYBIND);
List<AbstractConfigListEntry> list = new ArrayList<>();
ConfigEntryBuilder builder = ConfigEntryBuilder.create();
list.add(builder.startModifierKeyCodeField(Text.translatable(i18n), keyCode)
.setModifierSaveConsumer(point::setKeyBind)
.setAllowMouse(false)
.build());
return list;
}, ModifierKeyCodeImpl.class);