paper is fighting me

This commit is contained in:
2023-12-10 13:12:22 -06:00
parent 569338c315
commit 747552d1a2
6 changed files with 35 additions and 30 deletions

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sat, 12 Mar 2022 19:34:59 -0700
From: Telesphoreo <me@telesphoreo.me>
Date: Sun, 10 Dec 2023 13:11:22 -0600
Subject: [PATCH] UUID validation
@ -22,26 +22,18 @@ index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b
// Paper end
String string = nbt.getString("Name");
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644
index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e53f359efa 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 = BuiltInRegistries.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 {
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.TagParser;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.ExtraCodecs;
+import net.minecraft.util.GsonHelper;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
@@ -161,7 +162,14 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
@ -54,6 +46,6 @@ index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d
+ return null;
+ }
+ // Scissors end
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
} catch (Exception var5) {
return null;
return DataResult.error(() -> {