aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2022-01-06 09:00:23 -0800
committerAnthony Hilyard <anthony.hilyard@gmail.com>2022-01-06 09:00:23 -0800
commit2f42181876880c5a88de8b8fb29d9be84c3e0424 (patch)
tree8f00360424683557c88cacb4b82d5a9781a30657
parentf8c05d3ed6f96393f34f4ab661e99d3083f893b6 (diff)
downloadIceberg-2f42181876880c5a88de8b8fb29d9be84c3e0424.tar.gz
Iceberg-2f42181876880c5a88de8b8fb29d9be84c3e0424.tar.bz2
Iceberg-2f42181876880c5a88de8b8fb29d9be84c3e0424.zip
Fixed crash issue with modded tooltip components that aren't added to
factory.
-rw-r--r--CHANGELOG.md3
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java12
3 files changed, 15 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe4906c..f72768f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+### 1.0.36
+- Fixed a crash issue with modded tooltip components that are not properly added to tooltip component factory.
+
### 1.0.35
- Fixed an issue that could cause dependent client-side mods to crash when run on a dedicated server.
- Fixed various warnings in latest.log file.
diff --git a/gradle.properties b/gradle.properties
index a657a8b..bf52eb2 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,7 +6,7 @@ org.gradle.daemon=false
name=${rootProject.name}
group=com.anthonyhilyard.${name.toLowerCase()}
author=anthonyhilyard
-version=1.0.35
+version=1.0.36
mcVersion=1.18.1
fabricVersion=0.45.0+1.18
diff --git a/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java b/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java
index 7143b25..277f5c4 100644
--- a/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java
+++ b/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java
@@ -254,7 +254,17 @@ public class Tooltips
return eventResult.tooltipElements().stream().map(either -> either.map(text ->
ClientTooltipComponent.create(text instanceof Component ? ((Component) text).getVisualOrderText() : Language.getInstance().getVisualOrder(text)),
- ClientTooltipComponent::create)).toList();
+ x -> {
+ // First try using the create method, for vanilla and properly-implemented tooltip components.
+ try {
+ return ClientTooltipComponent.create(x);
+ }
+ // If that fails, attempt just casting it.
+ catch (IllegalArgumentException e)
+ {
+ return (ClientTooltipComponent)x;
+ }
+ })).toList();
}
public static Rect2i calculateRect(final ItemStack stack, PoseStack poseStack, List<ClientTooltipComponent> components,