mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-26 22:55:39 +00:00
Add a few more
Note that patch 10 had some changes so I took a guess on how to fix it. Needs testing most likely
This commit is contained in:
parent
5edc7febfe
commit
2edf8fa89b
@ -1,32 +0,0 @@
|
||||
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
|
||||
index 46681f3fa63516aa750de11cf1dee17cb3734fcd..41d23c244e5e87fdeac75820919adfb5ab6e3d1d 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -230,7 +230,7 @@ public final class NbtUtils {
|
||||
if (!nbt.contains("Name", 8)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
} else {
|
||||
- Block block = Registry.BLOCK.get(new ResourceLocation(nbt.getString("Name")));
|
||||
+ Block block = Registry.BLOCK.get(ResourceLocation.tryParse(nbt.getString("Name"))); // Scissors - Validate BlockState
|
||||
BlockState blockState = block.defaultBlockState();
|
||||
if (nbt.contains("Properties", 10)) {
|
||||
CompoundTag compoundTag = nbt.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
|
||||
index def3b3f8dac4b28eaaafdd9bc2e7f4b9ec9d6855..5e23504fa6902a5a6f0e95db1f51970f58edad88 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -551,7 +551,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
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"));
|
@ -5,10 +5,10 @@ Subject: [PATCH] ItemEntity - Check if items are air before calling setItem
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index c8d8fdef7b8abc0f59b7d19462825ae30c8d4f48..7126e0ccf894443f5f9c8e365dc1033daf20de57 100644
|
||||
index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..c82934529463be0adeb8585e7f702aebaf2a6a97 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -409,11 +409,14 @@ public class ItemEntity extends Entity {
|
||||
@@ -407,11 +407,14 @@ public class ItemEntity extends Entity {
|
||||
|
||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Telesphoreo <me@telesphoreo.me>
|
||||
Date: Sat, 10 Dec 2022 22:46:24 -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
|
||||
index c33a6d3d5700a7ec1dae2434d00cf0f480a5f0e5..1ccf1d22ac77b669fffd2a1bd7b1331cf0fa281a 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -234,7 +234,7 @@ public final class NbtUtils {
|
||||
if (!nbt.contains("Name", 8)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
} else {
|
||||
- ResourceLocation resourceLocation = new ResourceLocation(nbt.getString("Name"));
|
||||
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState
|
||||
Optional<? extends Holder<Block>> optional = blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation));
|
||||
if (optional.isEmpty()) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index e7ef36dac559d03d127cf45373a7e0dc935b80a8..9e6ef0c4aae1439bedddc317f05bf7f267c6c372 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -552,7 +552,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
this.setCritArrow(nbt.getBoolean("crit"));
|
||||
this.setPierceLevel(nbt.getByte("PierceLevel"));
|
||||
if (nbt.contains("SoundEvent", 8)) {
|
||||
- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
|
||||
+ this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Scissors - Validate SoundEvents before trying to play them
|
||||
}
|
||||
|
||||
this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow"));
|
Loading…
Reference in New Issue
Block a user