From fdc2ea2808818e3144af1222d18ffa1f89d8deac 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 --- .../Validate-ResourceLocation-in-NBT-reading.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patches/server/Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/Validate-ResourceLocation-in-NBT-reading.patch index 7026cf807b..2c7cd61552 100644 --- a/patches/server/Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/Validate-ResourceLocation-in-NBT-reading.patch @@ -21,6 +21,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityType.java ++++ b/src/main/java/net/minecraft/world/entity/EntityType.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java