Validate missed resource location parsing

This commit is contained in:
Nassim Jahnke 2024-01-06 09:51:49 +01:00
parent a58e29db99
commit 570cfb44d6
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F

View file

@ -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<T extends Entity> implements FeatureElement, EntityTypeT
}
public static Optional<EntityType<?>> 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