diff options
author | isXander <xander@isxander.dev> | 2024-02-29 22:22:46 +0000 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2024-02-29 22:22:46 +0000 |
commit | 308d882fc015fd448deb059b2a814246f7a32f05 (patch) | |
tree | 257777901c4db53220d4ae4ea869426633a42b25 | |
parent | 0a10f11494db07f974b416c1f69184728b68374c (diff) | |
download | YetAnotherConfigLib-308d882fc015fd448deb059b2a814246f7a32f05.tar.gz YetAnotherConfigLib-308d882fc015fd448deb059b2a814246f7a32f05.tar.bz2 YetAnotherConfigLib-308d882fc015fd448deb059b2a814246f7a32f05.zip |
Start work on 1.20.5
12 files changed, 32 insertions, 47 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java b/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java index 4e7c931..91749ba 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java +++ b/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java @@ -4,6 +4,7 @@ import com.google.gson.*; import dev.isxander.yacl3.config.v2.impl.serializer.GsonConfigSerializer; import dev.isxander.yacl3.gui.utils.ItemRegistryHelper; import dev.isxander.yacl3.impl.utils.YACLConstants; +import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; @@ -67,7 +68,7 @@ public class GsonConfigInstance<T> extends ConfigInstance<T> { this.path = path; this.gson = builder .setExclusionStrategies(new ConfigExclusionStrategy()) - .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter()) + .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter(RegistryAccess.EMPTY)) .registerTypeHierarchyAdapter(Style.class, new GsonConfigSerializer.StyleTypeAdapter()) .registerTypeHierarchyAdapter(Color.class, new ColorTypeAdapter()) .registerTypeHierarchyAdapter(Item.class, new ItemTypeAdapter()) @@ -162,7 +163,7 @@ public class GsonConfigInstance<T> extends ConfigInstance<T> { private UnaryOperator<GsonBuilder> gsonBuilder = builder -> builder .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .serializeNulls() - .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter()) + .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter(RegistryAccess.EMPTY)) .registerTypeHierarchyAdapter(Style.class, new GsonConfigSerializer.StyleTypeAdapter()) .registerTypeHierarchyAdapter(Color.class, new ColorTypeAdapter()) .registerTypeHierarchyAdapter(Item.class, new ItemTypeAdapter()); diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java index d38fb73..8cd1ed4 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java @@ -9,6 +9,7 @@ import dev.isxander.yacl3.gui.utils.ItemRegistryHelper; import dev.isxander.yacl3.impl.utils.YACLConstants; import dev.isxander.yacl3.platform.YACLPlatform; import net.minecraft.commands.ParserUtils; +import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; @@ -220,7 +221,7 @@ public class GsonConfigSerializer<T> extends ConfigSerializer<T> { private UnaryOperator<GsonBuilder> gsonBuilder = builder -> builder .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .serializeNulls() - .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter()) + .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter(RegistryAccess.EMPTY)) .registerTypeHierarchyAdapter(Style.class, new StyleTypeAdapter()) .registerTypeHierarchyAdapter(Color.class, new ColorTypeAdapter()) .registerTypeHierarchyAdapter(Item.class, new ItemTypeAdapter()) diff --git a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java index 91cda1f..56dcfcc 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java @@ -21,7 +21,6 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten public ElementListWidgetExt(Minecraft client, int x, int y, int width, int height, boolean smoothScrolling) { super(client, x, y, width, height); this.doSmoothScrolling = smoothScrolling; - setRenderBackground(true); setRenderHeader(false, 0); } @@ -124,7 +123,7 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten } @Override - protected void renderList(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + protected void renderListItems(GuiGraphics graphics, int mouseX, int mouseY, float delta) { int left = this.getRowLeft(); int right = this.getRowWidth(); int count = this.getItemCount(); diff --git a/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java b/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java index e8b4eb6..20604ef 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java @@ -244,6 +244,10 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } } + @Override + protected void renderListBackground(GuiGraphics guiGraphics) { + } + public abstract class Entry extends ElementListWidgetExt.Entry<Entry> { public boolean isViewable() { return true; diff --git a/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java b/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java index f439301..f88bdc3 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java @@ -15,7 +15,8 @@ public class TooltipButtonWidget extends Button { public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, Component tooltip, OnPress onPress) { super(x, y, width, height, message, onPress, DEFAULT_NARRATION); this.screen = screen; - if (tooltip != null) - setTooltip(new YACLTooltip(tooltip, this)); + // TODO + if (tooltip != null); + //setTooltip(new YACLTooltip(tooltip, this)); } } diff --git a/common/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java b/common/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java index fbb2fd0..a24b87a 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java @@ -84,12 +84,6 @@ public class YACLScreen extends Screen { config.initConsumer().accept(this); } - @Override - public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { - renderDirtBackground(graphics); - super.render(graphics, mouseX, mouseY, delta); - } - protected void finishOrSave() { saveButtonMessage = null; @@ -179,6 +173,11 @@ public class YACLScreen extends Screen { } @Override + protected void renderMenuBackground(GuiGraphics guiGraphics) { + this.renderMenuBackground(guiGraphics, 0, this.tabArea.top() + 1, this.width, this.tabArea.height()); + } + + @Override public boolean shouldCloseOnEsc() { if (pendingChanges()) { setSaveButtonMessage(Component.translatable("yacl.gui.save_before_exit").withStyle(ChatFormatting.RED), Component.translatable("yacl.gui.save_before_exit.tooltip")); @@ -341,11 +340,11 @@ public class YACLScreen extends Screen { public void updateButtons() { boolean pendingChanges = pendingChanges(); - undoButton.active = pendingChanges; - saveFinishedButton.setMessage(pendingChanges ? Component.translatable("yacl.gui.save") : GuiUtils.translatableFallback("yacl.gui.done", CommonComponents.GUI_DONE)); - saveFinishedButton.setTooltip(new YACLTooltip(pendingChanges ? Component.translatable("yacl.gui.save.tooltip") : Component.translatable("yacl.gui.finished.tooltip"), saveFinishedButton)); + // TODO + undoButton.active = pendingChanges; saveFinishedButton.setMessage(pendingChanges ? Component.translatable("yacl.gui.save") : GuiUtils.translatableFallback("yacl.gui.done", CommonComponents.GUI_DONE)); + //saveFinishedButton.setTooltip(new YACLTooltip(pendingChanges ? Component.translatable("yacl.gui.save.tooltip") : Component.translatable("yacl.gui.finished.tooltip"), saveFinishedButton)); cancelResetButton.setMessage(pendingChanges ? GuiUtils.translatableFallback("yacl.gui.cancel", CommonComponents.GUI_CANCEL) : Component.translatable("controls.reset")); - cancelResetButton.setTooltip(new YACLTooltip(pendingChanges ? Component.translatable("yacl.gui.cancel.tooltip") : Component.translatable("yacl.gui.reset.tooltip"), cancelResetButton)); + //cancelResetButton.setTooltip(new YACLTooltip(pendingChanges ? Component.translatable("yacl.gui.cancel.tooltip") : Component.translatable("yacl.gui.reset.tooltip"), cancelResetButton)); } } diff --git a/common/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java b/common/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java deleted file mode 100644 index 966b8a8..0000000 --- a/common/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.isxander.yacl3.gui; - -import net.minecraft.client.gui.components.Tooltip; -import net.minecraft.client.gui.navigation.ScreenRectangle; -import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; -import net.minecraft.network.chat.Component; - -public class YACLTooltip extends Tooltip { - private final net.minecraft.client.gui.components.AbstractWidget widget; - - public YACLTooltip(Component tooltip, net.minecraft.client.gui.components.AbstractWidget widget) { - super(tooltip, tooltip); - this.widget = widget; - } - - @Override - protected ClientTooltipPositioner createTooltipPositioner(boolean bl, boolean bl2, ScreenRectangle screenRectangle) { - return new YACLTooltipPositioner(widget); - } -} diff --git a/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownControllerElement.java b/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownControllerElement.java index 0e62af4..31d4d51 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownControllerElement.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownControllerElement.java @@ -226,7 +226,7 @@ public abstract class AbstractDropdownControllerElement<T, U> extends StringCont public void renderDropdownBackground(GuiGraphics graphics, int numberOfItems) { graphics.setColor(0.25f, 0.25f, 0.25f, 1.0f); - graphics.blit(Screen.BACKGROUND_LOCATION, getDimension().x(), getDimension().yLimit() + 2, 0, 0.0f, 0.0f, getDimension().width(), getDimension().height() * numberOfItems + 2, 32, 32); + graphics.blit(Screen.MENU_BACKGROUND, getDimension().x(), getDimension().yLimit() + 2, 0, 0.0f, 0.0f, getDimension().width(), getDimension().height() * numberOfItems + 2, 32, 32); graphics.setColor(1.0f, 1.0f, 1.0f, 1.0f); graphics.renderOutline(getDimension().x(), getDimension().yLimit() + 2, getDimension().width(), getDimension().height() * numberOfItems, -1); } diff --git a/common/src/main/resources/yacl.accesswidener b/common/src/main/resources/yacl.accesswidener index 7c0e2ca..39e8981 100644 --- a/common/src/main/resources/yacl.accesswidener +++ b/common/src/main/resources/yacl.accesswidener @@ -4,7 +4,7 @@ extendable method net/minecraft/client/gui/components/AbstractSelectionList chil extendable method net/minecraft/client/gui/components/AbstractSelectionList getEntryAtPosition (DD)Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry; accessible class net/minecraft/client/gui/components/AbstractSelectionList$Entry accessible method net/minecraft/client/gui/components/tabs/TabNavigationBar <init> (ILnet/minecraft/client/gui/components/tabs/TabManager;Ljava/lang/Iterable;)V -accessible field net/minecraft/client/gui/components/tabs/TabNavigationBar layout Lnet/minecraft/client/gui/layouts/GridLayout; +accessible field net/minecraft/client/gui/components/tabs/TabNavigationBar layout Lnet/minecraft/client/gui/layouts/LinearLayout; accessible field net/minecraft/client/gui/components/tabs/TabNavigationBar width I accessible field net/minecraft/client/gui/components/tabs/TabNavigationBar tabManager Lnet/minecraft/client/gui/components/tabs/TabManager; accessible field net/minecraft/client/gui/components/tabs/TabNavigationBar tabs Lcom/google/common/collect/ImmutableList; diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 7f74e56..b3dd73b 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -17,7 +17,7 @@ "environment": "*", "depends": { "fabricloader": ">=0.14.0", - "minecraft": ["1.20.4", "1.20.3"], + "java": ">=17", "fabric-resource-loader-v0": "*" }, diff --git a/gradle.properties b/gradle.properties index f2a36fd..30a4ee4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,4 +8,4 @@ modrinthId=yacl curseforgeId=667299 githubProject=isXander/YetAnotherConfigLib -loaders=fabric,neoforge +loaders=fabric diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eaf7d03..3ece5ba 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] # Plugins -architectury_loom = "1.4.+" +architectury_loom = "1.5.+" architectury_plugin = "3.4.+" shadow = "7.1.+" minotaur = "2.7.+" @@ -9,17 +9,17 @@ github_release = "2.4.+" machete = "2.+" grgit = "5.0.+" -minecraft = "1.20.4" -parchment = "2023.10.22" -fabric_loader = "0.14.25" +minecraft = "24w09a" +parchment = "2023.12.10" +fabric_loader = "0.15.7" # Common Dependencies -mixin_extras = "0.2.0" +mixin_extras = "0.3.2" twelvemonkeys_imageio = "3.10.0" quilt_parsers = "0.2.1" # Fabric-like Dependencies -fabric_api = "0.91.1+1.20.3" +fabric_api = "0.96.5+1.20.5" # Forge Dependencies neoforge = "20.4.0-beta" |