PaperMC/paper-server/patches/sources/net/minecraft/nbt/NbtUtils.java.patch

16 lines
938 B
Diff
Raw Normal View History

--- a/net/minecraft/nbt/NbtUtils.java
+++ b/net/minecraft/nbt/NbtUtils.java
2024-12-14 23:35:55 +01:00
@@ -143,8 +_,10 @@
if (!tag.contains("Name", 8)) {
return Blocks.AIR.defaultBlockState();
} else {
2024-12-14 23:35:55 +01:00
- ResourceLocation resourceLocation = ResourceLocation.parse(tag.getString("Name"));
- Optional<? extends Holder<Block>> optional = blockGetter.get(ResourceKey.create(Registries.BLOCK, resourceLocation));
+ // Paper start - Validate resource location
2024-12-14 23:35:55 +01:00
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(tag.getString("Name"));
+ Optional<? extends Holder<Block>> optional = resourceLocation != null ? blockGetter.get(ResourceKey.create(Registries.BLOCK, resourceLocation)) : Optional.empty();
+ // Paper end - Validate resource location
if (optional.isEmpty()) {
return Blocks.AIR.defaultBlockState();
} else {