Validate ResourceLocation in NBT reading

This commit is contained in:
Nassim Jahnke
2024-01-04 13:49:14 +01:00
parent b37ffd3a00
commit 2506babe8e
11 changed files with 223 additions and 122 deletions

View File

@@ -216,6 +216,15 @@
}
}
@@ -665,7 +710,7 @@
this.setCritArrow(nbt.getBoolean("crit"));
this.setPierceLevel(nbt.getByte("PierceLevel"));
if (nbt.contains("SoundEvent", 8)) {
- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.parse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
+ this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Paper - Validate resource location
}
if (nbt.contains("item", 10)) {
@@ -675,7 +720,7 @@
}