Scissors/patches/server/0010-Validate-BlockState-and-SoundEvent-values.patch

20 lines
1.1 KiB
Diff
Raw Permalink Normal View History

2023-12-29 19:48:29 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 13 Mar 2022 21:56:29 -0600
Subject: [PATCH] Validate BlockState and SoundEvent values
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
2024-01-07 21:15:59 +00:00
index 80083fed4b44b9d433925f09db83e559582109a1..032fc2add6c25780a3663fd1d2e429fcfd37dc4a 100644
2023-12-29 19:48:29 +00:00
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -231,7 +231,7 @@ public final class NbtUtils {
return Blocks.AIR.defaultBlockState();
} else {
2024-01-07 21:15:59 +00:00
// Paper start - Validate resource location
- ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name"));
2023-12-29 19:48:29 +00:00
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState
2024-01-07 21:15:59 +00:00
Optional<? extends Holder<Block>> optional = resourceLocation != null ? blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation)) : Optional.empty();
// Paper end
2023-12-29 19:48:29 +00:00
if (optional.isEmpty()) {