mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-07-08 01:40:00 +00:00
43 lines
2.3 KiB
Diff
43 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Video <videogamesm12@gmail.com>
|
|
Date: Sat, 12 Mar 2022 19:34:59 -0700
|
|
Subject: [PATCH] Return null when a show_entity hover event's UUID isn't valid
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
index b31ff9d237f593e58b42b453632aa2c2af74f986..67feb4e688d049e9f74f0deabb1ec583336a29be 100644
|
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
@@ -174,7 +174,14 @@ public class HoverEvent {
|
|
} else {
|
|
JsonObject jsonObject = json.getAsJsonObject();
|
|
EntityType<?> entityType = Registry.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
|
|
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
|
+ // Scissors start
|
|
+ UUID uUID;
|
|
+ try {
|
|
+ uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
|
+ } catch (Exception ex) {
|
|
+ return null;
|
|
+ }
|
|
+ // Scissors end
|
|
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
|
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
|
}
|
|
@@ -186,7 +193,14 @@ public class HoverEvent {
|
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
|
EntityType<?> entityType = Registry.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
|
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
|
+ // Scissors start
|
|
+ UUID uUID;
|
|
+ try {
|
|
+ uUID = UUID.fromString(compoundTag.getString("id"));
|
|
+ } catch (Exception ex) {
|
|
+ return null;
|
|
+ }
|
|
+ // Scissors end
|
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
|
} catch (Exception var5) {
|
|
return null;
|