2022-03-14 04:07:59 +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
2022-05-30 01:36:12 +00:00
index 050ee055b9a2a0767f58d6677ad7f2d927fbaa54..9ec5bc2c29fc98ac2fbf9ff6231e8c3215ff11a1 100644
2022-03-14 04:07:59 +00:00
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
2022-05-30 01:36:12 +00:00
@@ -229,7 +229,7 @@ public final class NbtUtils {
2022-03-14 04:07:59 +00:00
if (!compound.contains("Name", 8)) {
return Blocks.AIR.defaultBlockState();
} else {
- Block block = Registry.BLOCK.get(new ResourceLocation(compound.getString("Name")));
+ Block block = Registry.BLOCK.get(ResourceLocation.tryParse(compound.getString("Name"))); // Scissors - Validate BlockState
BlockState blockState = block.defaultBlockState();
if (compound.contains("Properties", 10)) {
CompoundTag compoundTag = compound.getCompound("Properties");
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
2022-04-19 23:49:48 +00:00
index 53d0024daf6963ac4dab575666b0d6a74a39a958..ce13ba13c30428558391defbb09a49429dd10422 100644
2022-03-14 04:07:59 +00:00
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
2022-04-19 23:49:48 +00:00
@@ -549,7 +549,7 @@ public abstract class AbstractArrow extends Projectile {
2022-03-14 04:07:59 +00:00
this.setCritArrow(nbt.getBoolean("crit"));
this.setPierceLevel(nbt.getByte("PierceLevel"));
if (nbt.contains("SoundEvent", 8)) {
- this.soundEvent = (SoundEvent) Registry.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
+ this.soundEvent = (SoundEvent) Registry.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Scissors - Validate SoundEvents before trying to play them
}
this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow"));