aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2023-05-29 07:11:21 +0100
committerisXander <xander@isxander.dev>2023-05-29 07:11:21 +0100
commitdc8b14ee18c1d8737a836ac3c6c510e8f46f46eb (patch)
tree7f2a722fecdf2346eba60eeb770c856c737b3ced /common
parent0774170cda931fcee000d1ceeb633c28b73b43bd (diff)
downloadYetAnotherConfigLib-dc8b14ee18c1d8737a836ac3c6c510e8f46f46eb.tar.gz
YetAnotherConfigLib-dc8b14ee18c1d8737a836ac3c6c510e8f46f46eb.tar.bz2
YetAnotherConfigLib-dc8b14ee18c1d8737a836ac3c6c510e8f46f46eb.zip
Rename `OptionDescription#description` to `text` as well as relevant builder methods
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/dev/isxander/yacl/api/OptionDescription.java12
-rw-r--r--common/src/main/java/dev/isxander/yacl/gui/OptionDescriptionWidget.java4
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java6
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java2
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java3
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/OptionDescriptionImpl.java6
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java3
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java6
8 files changed, 16 insertions, 26 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java b/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java
index fbae4c2..849b601 100644
--- a/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java
+++ b/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java
@@ -22,7 +22,7 @@ public interface OptionDescription {
* including {@link net.minecraft.network.chat.ClickEvent}s and {@link net.minecraft.network.chat.HoverEvent}s.
* @return The description of the option, with all lines merged with \n.
*/
- Component description();
+ Component text();
/**
* The image to display with the description. If the Optional is empty, no image has been provided.
@@ -41,7 +41,7 @@ public interface OptionDescription {
}
static OptionDescription of(Component... description) {
- return createBuilder().description(description).build();
+ return createBuilder().text(description).build();
}
OptionDescription EMPTY = new OptionDescriptionImpl(CommonComponents.EMPTY, CompletableFuture.completedFuture(Optional.empty()));
@@ -50,22 +50,22 @@ public interface OptionDescription {
/**
* Appends lines to the main description of the option. This can be called multiple times.
* On {@link Builder#build()}, the lines are merged with \n.
- * @see OptionDescription#description()
+ * @see OptionDescription#text()
*
* @param description the lines to append to the description.
* @return this builder
*/
- Builder description(Component... description);
+ Builder text(Component... description);
/**
* Appends lines to the main description of the option. This can be called multiple times.
* On {@link Builder#build()}, the lines are merged with \n.
- * @see OptionDescription#description()
+ * @see OptionDescription#text()
*
* @param lines the lines to append to the description.
* @return this builder
*/
- Builder description(Collection<? extends Component> lines);
+ Builder text(Collection<? extends Component> lines);
/**
* Sets a static image to display with the description. This is backed by a regular minecraft resource
diff --git a/common/src/main/java/dev/isxander/yacl/gui/OptionDescriptionWidget.java b/common/src/main/java/dev/isxander/yacl/gui/OptionDescriptionWidget.java
index 9f0c642..fceb38a 100644
--- a/common/src/main/java/dev/isxander/yacl/gui/OptionDescriptionWidget.java
+++ b/common/src/main/java/dev/isxander/yacl/gui/OptionDescriptionWidget.java
@@ -81,7 +81,7 @@ public class OptionDescriptionWidget extends AbstractWidget {
}
if (wrappedText == null)
- wrappedText = font.split(description.description().description(), getWidth());
+ wrappedText = font.split(description.description().text(), getWidth());
descriptionY = y;
for (var line : wrappedText) {
@@ -188,7 +188,7 @@ public class OptionDescriptionWidget extends AbstractWidget {
protected void updateWidgetNarration(NarrationElementOutput builder) {
if (description != null) {
builder.add(NarratedElementType.TITLE, description.name());
- builder.add(NarratedElementType.HINT, description.description().description());
+ builder.add(NarratedElementType.HINT, description.description().text());
}
}
diff --git a/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
index c63dd99..d93dd1a 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
@@ -5,17 +5,13 @@ import dev.isxander.yacl.api.*;
import dev.isxander.yacl.gui.YACLScreen;
import dev.isxander.yacl.gui.controllers.ActionController;
import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.MutableComponent;
import org.apache.commons.lang3.Validate;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
-import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
-import java.util.function.Function;
@ApiStatus.Internal
public final class ButtonOptionImpl implements ButtonOption {
@@ -52,7 +48,7 @@ public final class ButtonOptionImpl implements ButtonOption {
@Override
public @NotNull Component tooltip() {
- return description().description();
+ return description().text();
}
@Override
diff --git a/common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java
index c1a6772..ae333a7 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java
@@ -29,7 +29,7 @@ public final class LabelOptionImpl implements LabelOption {
this.labelController = new LabelController(this);
this.binding = Binding.immutable(label);
this.description = OptionDescription.createBuilder()
- .description(this.label)
+ .text(this.label)
.build();
}
diff --git a/common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java
index 474a5f8..015a7c3 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java
@@ -3,7 +3,6 @@ package dev.isxander.yacl.impl;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import dev.isxander.yacl.api.*;
-import dev.isxander.yacl.impl.utils.YACLConstants;
import net.minecraft.network.chat.Component;
import org.apache.commons.lang3.Validate;
import org.jetbrains.annotations.ApiStatus;
@@ -58,7 +57,7 @@ public final class ListOptionImpl<T> implements ListOption<T> {
@Override
public @NotNull Component tooltip() {
- return description().description();
+ return description().text();
}
@Override
diff --git a/common/src/main/java/dev/isxander/yacl/impl/OptionDescriptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/OptionDescriptionImpl.java
index ba994e4..12c6ce7 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/OptionDescriptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/OptionDescriptionImpl.java
@@ -14,20 +14,20 @@ import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.CompletableFuture;
-public record OptionDescriptionImpl(Component description, CompletableFuture<Optional<ImageRenderer>> image) implements OptionDescription {
+public record OptionDescriptionImpl(Component text, CompletableFuture<Optional<ImageRenderer>> image) implements OptionDescription {
public static class BuilderImpl implements Builder {
private final List<Component> descriptionLines = new ArrayList<>();
private CompletableFuture<Optional<ImageRenderer>> image = CompletableFuture.completedFuture(Optional.empty());
private boolean imageUnset = true;
@Override
- public Builder description(Component... description) {
+ public Builder text(Component... description) {
this.descriptionLines.addAll(Arrays.asList(description));
return this;
}
@Override
- public Builder description(Collection<? extends Component> lines) {
+ public Builder text(Collection<? extends Component> lines) {
this.descriptionLines.addAll(lines);
return this;
}
diff --git a/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java b/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java
index 37eddfd..8c2a1cf 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java
@@ -5,7 +5,6 @@ import dev.isxander.yacl.api.ListOption;
import dev.isxander.yacl.api.Option;
import dev.isxander.yacl.api.OptionDescription;
import dev.isxander.yacl.api.OptionGroup;
-import dev.isxander.yacl.impl.utils.YACLConstants;
import net.minecraft.network.chat.Component;
import org.apache.commons.lang3.Validate;
import org.jetbrains.annotations.ApiStatus;
@@ -43,7 +42,7 @@ public final class OptionGroupImpl implements OptionGroup {
@Override
public @NotNull Component tooltip() {
- return description.description();
+ return description.text();
}
@Override
diff --git a/common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java
index 29ca48d..a3dd1d5 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java
@@ -3,15 +3,11 @@ package dev.isxander.yacl.impl;
import com.google.common.collect.ImmutableSet;
import dev.isxander.yacl.api.*;
import dev.isxander.yacl.api.controller.ControllerBuilder;
-import dev.isxander.yacl.impl.utils.YACLConstants;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.ComponentContents;
-import net.minecraft.network.chat.MutableComponent;
import org.apache.commons.lang3.Validate;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.function.BiConsumer;
@@ -66,7 +62,7 @@ public final class OptionImpl<T> implements Option<T> {
@Override
public @NotNull Component tooltip() {
- return description.description();
+ return description.text();
}
@Override