aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/api/utils
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2022-11-13 19:04:45 +0000
committerisXander <xandersmith2008@gmail.com>2022-11-13 19:04:55 +0000
commit6f3dc40a6bc554b6decb685cb6d1eb6370b1eea6 (patch)
tree3245fcd0782ff44c9f7c62f26844ab4c7510bbeb /src/main/java/dev/isxander/yacl/api/utils
parentb9052c99778b5ad6e54e720f6f10756e8ef8cdc0 (diff)
downloadYetAnotherConfigLib-6f3dc40a6bc554b6decb685cb6d1eb6370b1eea6.tar.gz
YetAnotherConfigLib-6f3dc40a6bc554b6decb685cb6d1eb6370b1eea6.tar.bz2
YetAnotherConfigLib-6f3dc40a6bc554b6decb685cb6d1eb6370b1eea6.zip
lots of QOL and minor improvements
smooth category scrolling individual reset buttons for all controllers separate Dimension into Dimension and MutableDimension to prevent mods from modifying controller dimensions without invoking the hooks made the dimension field private in AbstractWidget so people can't modify it without the method setDimension new Option API method to check if pending value is equal to default value add documentation to ConfigInstance fix bug where Option#requestSetDefault and Option#forgetPendingValue implementations weren't notifying listeners
Diffstat (limited to 'src/main/java/dev/isxander/yacl/api/utils')
-rw-r--r--src/main/java/dev/isxander/yacl/api/utils/Dimension.java12
-rw-r--r--src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java11
2 files changed, 13 insertions, 10 deletions
diff --git a/src/main/java/dev/isxander/yacl/api/utils/Dimension.java b/src/main/java/dev/isxander/yacl/api/utils/Dimension.java
index 69958b1..0de0a58 100644
--- a/src/main/java/dev/isxander/yacl/api/utils/Dimension.java
+++ b/src/main/java/dev/isxander/yacl/api/utils/Dimension.java
@@ -17,25 +17,17 @@ public interface Dimension<T extends Number> {
boolean isPointInside(T x, T y);
- Dimension<T> clone();
-
- Dimension<T> setX(T x);
- Dimension<T> setY(T y);
- Dimension<T> setWidth(T width);
- Dimension<T> setHeight(T height);
+ MutableDimension<T> clone();
Dimension<T> withX(T x);
Dimension<T> withY(T y);
Dimension<T> withWidth(T width);
Dimension<T> withHeight(T height);
- Dimension<T> move(T x, T y);
- Dimension<T> expand(T width, T height);
-
Dimension<T> moved(T x, T y);
Dimension<T> expanded(T width, T height);
- static Dimension<Integer> ofInt(int x, int y, int width, int height) {
+ static MutableDimension<Integer> ofInt(int x, int y, int width, int height) {
return new DimensionIntegerImpl(x, y, width, height);
}
}
diff --git a/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java b/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java
new file mode 100644
index 0000000..eff0186
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java
@@ -0,0 +1,11 @@
+package dev.isxander.yacl.api.utils;
+
+public interface MutableDimension<T extends Number> extends Dimension<T> {
+ MutableDimension<T> setX(T x);
+ MutableDimension<T> setY(T y);
+ MutableDimension<T> setWidth(T width);
+ MutableDimension<T> setHeight(T height);
+
+ MutableDimension<T> move(T x, T y);
+ MutableDimension<T> expand(T width, T height);
+}