diff --git a/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/BlendiumYACLConfigScreenBuilder.java b/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/BlendiumYACLConfigScreenBuilder.java index 3f903f9..f0f374b 100644 --- a/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/BlendiumYACLConfigScreenBuilder.java +++ b/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/BlendiumYACLConfigScreenBuilder.java @@ -37,7 +37,7 @@ private static ConfigCategory buildMainCategory() { Text.translatable("blendium.config.category.main.title.tooltip")).group(MapOption.createBuilder().name( Text.translatable("blendium.config.shaderpackBrightnessMultipliers")).description( OptionDescription.of(Text.translatable("blendium.config.shaderpackBrightnessMultipliers.tooltip"))).binding( - Collections.emptyMap(), () -> BlendiumClient.config.shaderpackBrightnessMultipliers, + BlendiumClient.config.shaderpackBrightnessMultipliers, () -> BlendiumClient.config.shaderpackBrightnessMultipliers, newValue -> BlendiumClient.config.shaderpackBrightnessMultipliers = newValue ).initial(() -> new AbstractMap.SimpleEntry<>("(off)", 1.0)).keyController(stringDoubleMapOptionEntry -> StringControllerBuilder.create( (Option) (Object) stringDoubleMapOptionEntry)).valueController(DoubleFieldControllerBuilder::create).build()).build(); diff --git a/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/gui/controllers/MapEntryWidget.java b/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/gui/controllers/MapEntryWidget.java index e0566f9..54dbfa9 100644 --- a/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/gui/controllers/MapEntryWidget.java +++ b/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/gui/controllers/MapEntryWidget.java @@ -82,7 +82,7 @@ public void render(DrawContext graphics, int mouseX, int mouseY, float delta) { removeButton.render(graphics, mouseX, mouseY, delta); moveUpButton.render(graphics, mouseX, mouseY, delta); moveDownButton.render(graphics, mouseX, mouseY, delta); - entryWidget.render(graphics, mouseX, mouseY, delta); +// entryWidget.render(graphics, mouseX, mouseY, delta); } protected void updateButtonStates() { diff --git a/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/option/impl/MapOptionImpl.java b/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/option/impl/MapOptionImpl.java index af40d96..02c0b14 100644 --- a/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/option/impl/MapOptionImpl.java +++ b/src/main/java/io/github/steveplays28/blendium/client/compat/yacl/option/impl/MapOptionImpl.java @@ -154,10 +154,11 @@ public boolean changed() { @Override public @NotNull Map pendingValue() { // TODO: Refactor into a method - Map mapEntries = new Object2ObjectArrayMap<>(); + Map mapEntries = new HashMap<>(); for (MapOptionEntry entry : entries) { - mapEntries.entrySet().add((Map.Entry) entry.pendingValue()); + var mapEntry = (Map.Entry) entry.pendingValue(); + mapEntries.put(mapEntry.getKey(), mapEntry.getValue()); } return mapEntries; @@ -224,9 +225,8 @@ public boolean isRoot() { return false; } - @SuppressWarnings("unchecked") private List> createEntries(Map values) { - return values.entrySet().stream().filter(Map.class::isInstance).map(entryFactory::create).filter(MapOptionEntry.class::isInstance).toList(); + return values.entrySet().stream().filter(Objects::nonNull).map(entryFactory::create).toList(); } void callListeners(boolean bypass) { @@ -426,8 +426,9 @@ public MapOption build() { Validate.notNull(binding, "`binding` must not be null"); Validate.notNull(initialValue, "`initialValue` must not be null"); - return new MapOptionImpl<>(name, description, binding, initialValue, keyControllerFunction, valueControllerFunction, ImmutableSet.copyOf(flags), collapsed, - available, minimumNumberOfEntries, maximumNumberOfEntries, insertEntriesAtEnd, listeners + return new MapOptionImpl<>(name, description, binding, initialValue, keyControllerFunction, valueControllerFunction, + ImmutableSet.copyOf(flags), collapsed, available, minimumNumberOfEntries, maximumNumberOfEntries, insertEntriesAtEnd, + listeners ); } }