From 570cfb44d6f0c2333db7c6fa05b520820c631e99 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 6 Jan 2024 09:51:49 +0100 Subject: [PATCH] Validate missed resource location parsing --- ...0-Validate-ResourceLocation-in-NBT-reading.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patches/server/1060-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/1060-Validate-ResourceLocation-in-NBT-reading.patch index 9f876b434..645e44224 100644 --- a/patches/server/1060-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/1060-Validate-ResourceLocation-in-NBT-reading.patch @@ -21,6 +21,19 @@ index 18fad4f083862ace2bc56579883f548f6d697091..80083fed4b44b9d433925f09db83e559 if (optional.isEmpty()) { return Blocks.AIR.defaultBlockState(); } else { +diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java +index 00389d7ec3e8b059d5591a2019ba240fda2901fe..6cfce9755dd464a7afb01f9032e567ce3bcd5bc5 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityType.java ++++ b/src/main/java/net/minecraft/world/entity/EntityType.java +@@ -618,7 +618,7 @@ public class EntityType implements FeatureElement, EntityTypeT + } + + public static Optional> by(CompoundTag nbt) { +- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id"))); ++ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); // Paper - Validate ResourceLocation + } + + @Nullable diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index e0cf7771488ab0065708d68b4e8550b865af0ed4..a7fbd329ea6d36a46c00b4476c74e426dbbfe238 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java