aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java12
-rw-r--r--src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java6
-rw-r--r--src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java20
-rw-r--r--src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java4
-rw-r--r--src/main/java/dev/isxander/yacl3/gui/YACLScreen.java12
-rw-r--r--src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java6
-rw-r--r--src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java6
-rw-r--r--src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java6
-rw-r--r--src/main/resources/META-INF/mods.toml8
-rw-r--r--src/testmod/resources/META-INF/mods.toml8
10 files changed, 47 insertions, 41 deletions
diff --git a/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java b/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java
index c47afe2..83a0b1c 100644
--- a/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java
+++ b/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java
@@ -68,11 +68,11 @@ public class GsonConfigInstance<T> extends ConfigInstance<T> {
this.path = path;
this.gson = builder
.setExclusionStrategies(new ConfigExclusionStrategy())
- /*? if >1.20.4 { *//*
+ /*? if >1.20.4 { */
.registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter(RegistryAccess.EMPTY))
- *//*? } elif =1.20.4 {*/
+ /*? } elif =1.20.4 {*//*
.registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter())
- /*? } else {*//*
+ *//*? } else {*//*
.registerTypeHierarchyAdapter(Component.class, new Component.Serializer())
*//*?}*/
.registerTypeHierarchyAdapter(Style.class, /*? if >=1.20.4 {*/new GsonConfigSerializer.StyleTypeAdapter()/*?} else {*//*new Style.Serializer()*//*?}*/)
@@ -169,11 +169,11 @@ public class GsonConfigInstance<T> extends ConfigInstance<T> {
private UnaryOperator<GsonBuilder> gsonBuilder = builder -> builder
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.serializeNulls()
- /*? if >1.20.4 { *//*
+ /*? if >1.20.4 { */
.registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter(RegistryAccess.EMPTY))
- *//*? } elif =1.20.4 {*/
+ /*? } elif =1.20.4 {*//*
.registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter())
- /*? } else {*//*
+ *//*? } else {*//*
.registerTypeHierarchyAdapter(Component.class, new Component.Serializer())
*//*?}*/
.registerTypeHierarchyAdapter(Style.class, /*? if >=1.20.4 {*/new GsonConfigSerializer.StyleTypeAdapter()/*?} else {*//*new Style.Serializer()*//*?}*/)
diff --git a/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java b/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java
index 9f6d8c8..3492c55 100644
--- a/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java
+++ b/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java
@@ -221,11 +221,11 @@ public class GsonConfigSerializer<T> extends ConfigSerializer<T> {
private UnaryOperator<GsonBuilder> gsonBuilder = builder -> builder
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.serializeNulls()
- /*? if >1.20.4 { *//*
+ /*? if >1.20.4 { */
.registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter(RegistryAccess.EMPTY))
- *//*? } elif =1.20.4 {*/
+ /*? } elif =1.20.4 {*//*
.registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter())
- /*? } else {*//*
+ *//*? } else {*//*
.registerTypeHierarchyAdapter(Component.class, new Component.Serializer())
*//*?}*/
.registerTypeHierarchyAdapter(Style.class, /*? if >=1.20.4 {*/new StyleTypeAdapter()/*?} else {*//*new Style.Serializer()*//*?}*/)
diff --git a/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java b/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java
index 742125b..b183dc8 100644
--- a/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java
+++ b/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java
@@ -169,11 +169,25 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten
}
@Override
- /*? if >1.20.4 {*//*
+ protected void ensureVisible(E entry) {
+ int i = this.getRowTop(this.children().indexOf(entry));
+ int j = i - this.getY() - 4 - entry.getItemHeight();
+ if (j < 0) {
+ this.setScrollAmount(this.getScrollAmount() + j);
+ }
+
+ int k = this.getBottom() - i - entry.getItemHeight() * 2;
+ if (k < 0) {
+ this.setScrollAmount(this.getScrollAmount() - k);
+ }
+ }
+
+ @Override
+ /*? if >1.20.4 {*/
protected void renderListItems(GuiGraphics graphics, int mouseX, int mouseY, float delta)
- *//*? } else {*/
+ /*? } else {*//*
protected void renderList(GuiGraphics graphics, int mouseX, int mouseY, float delta)
- /*?}*/
+ *//*?}*/
{
int left = this.getRowLeft();
int right = this.getRowWidth();
diff --git a/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java b/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java
index f699f0c..9827aab 100644
--- a/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java
+++ b/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java
@@ -244,11 +244,11 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr
}
}
- /*? if >1.20.4 {*//*
+ /*? if >1.20.4 {*/
@Override
protected void renderListBackground(GuiGraphics guiGraphics) {
}
- *//*?}*/
+ /*?}*/
public abstract class Entry extends ElementListWidgetExt.Entry<Entry> {
public boolean isViewable() {
diff --git a/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java
index 2eeb7d5..59f16ff 100644
--- a/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java
+++ b/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java
@@ -121,13 +121,13 @@ public class YACLScreen extends Screen {
currentPopupController = null;
}
- /*? if <=1.20.4 {*/
+ /*? if <=1.20.4 {*//*
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
renderDirtBackground(graphics);
super.render(graphics, mouseX, mouseY, delta);
}
- /*?}*/
+ *//*?}*/
@Override
public void renderBackground(GuiGraphics guiGraphics/*? if >1.20.1 {*/, int mouseX, int mouseY, float partialTick/*?}*/) {
@@ -286,9 +286,9 @@ public class YACLScreen extends Screen {
}
public static class CategoryTab implements TabExt {
- /*? if >1.20.4 {*//*
+ /*? if >1.20.4 {*/
private static final ResourceLocation DARKER_BG = new ResourceLocation("textures/gui/menu_list_background.png");
- *//*?}*/
+ /*?}*/
private final YACLScreen screen;
private final ConfigCategory category;
@@ -379,7 +379,7 @@ public class YACLScreen extends Screen {
consumer.accept(descriptionWidget);
}
- /*? if >1.20.4 {*//*
+ /*? if >1.20.4 {*/
@Override
public void renderBackground(GuiGraphics graphics) {
RenderSystem.enableBlend();
@@ -401,7 +401,7 @@ public class YACLScreen extends Screen {
RenderSystem.disableBlend();
}
- *//*?}*/
+ /*?}*/
@Override
public void doLayout(ScreenRectangle screenRectangle) {
diff --git a/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java b/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java
index 94b91a9..33028d7 100644
--- a/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java
+++ b/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java
@@ -13,11 +13,11 @@ public class YACLTooltip extends Tooltip {
this.widget = widget;
}
- /*? if >1.20.4 {*//* // stonecutter cannot handle AND expressions
- *//*? } elif >1.20.1 {*/
+ /*? if >1.20.4 {*/ // stonecutter cannot handle AND expressions
+ /*? } elif >1.20.1 {*//*
@Override
protected ClientTooltipPositioner createTooltipPositioner(boolean bl, boolean bl2, ScreenRectangle screenRectangle) {
return new YACLTooltipPositioner(widget);
}
- /*?}*/
+ *//*?}*/
}
diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java b/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java
index f16a1dd..6252291 100644
--- a/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java
+++ b/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java
@@ -61,11 +61,11 @@ public class DropdownWidget<T> extends ControllerPopupWidget<AbstractDropdownCon
// Background
graphics.setColor(0.25f, 0.25f, 0.25f, 1.0f);
graphics.blit(
- /*? if >1.20.4 {*//*
+ /*? if >1.20.4 {*/
Screen.MENU_BACKGROUND,
- *//*?} else {*/
+ /*?} else {*//*
Screen.BACKGROUND_LOCATION,
- /*?}*/
+ *//*?}*/
dropdownDim.x(), dropdownDim.y(), 0,
0.0f, 0.0f,
dropdownDim.width(), dropdownDim.height(),
diff --git a/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java b/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java
index 8850390..e0fe06c 100644
--- a/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java
+++ b/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java
@@ -10,13 +10,13 @@ import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(TabNavigationBar.class)
public interface TabNavigationBarAccessor {
- /*? if >1.20.4 {*//*
+ /*? if >1.20.4 {*/
@Accessor("layout")
net.minecraft.client.gui.layouts.LinearLayout yacl$getLayout();
- *//*? } else {*/
+ /*? } else {*//*
@Accessor("layout")
net.minecraft.client.gui.layouts.GridLayout yacl$getLayout();
- /*?}*/
+ *//*?}*/
@Accessor("width")
int yacl$getWidth();
diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml
index b130a4e..3954b6f 100644
--- a/src/main/resources/META-INF/mods.toml
+++ b/src/main/resources/META-INF/mods.toml
@@ -1,5 +1,5 @@
modLoader = "javafml"
-loaderVersion = "[1,)"
+loaderVersion = "${loaderVersion}"
#issueTrackerURL = ""
license = "LGPL-3.0-or-later"
@@ -17,15 +17,15 @@ logoFile = "yacl-128x.png"
config = "yacl.mixins.json"
[["dependencies.${id}"]]
-modId = "neoforge"
+modId = "${forgeId}"
mandatory = true
-versionRange = "[20,)"
+versionRange = "${forgeConstraint}"
ordering = "NONE"
side = "BOTH"
[["dependencies.${id}"]]
modId = "minecraft"
mandatory = true
-versionRange = "[1.20.3,)"
+versionRange = "${mc}"
ordering = "NONE"
side = "BOTH"
diff --git a/src/testmod/resources/META-INF/mods.toml b/src/testmod/resources/META-INF/mods.toml
index 74e4078..2af31d4 100644
--- a/src/testmod/resources/META-INF/mods.toml
+++ b/src/testmod/resources/META-INF/mods.toml
@@ -15,11 +15,3 @@ authors = "isXander"
[[mixins]]
config = "yacl-test.mixins.json"
-[[dependencies.yacl_test]]
-modId = "neoforge"
-mandatory = true
-
-[[dependencies.yacl_test]]
-modId = "minecraft"
-mandatory = true
-