From f8d4eb9eaab2beb2a62fb88e9071d31bf607e8b1 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Fri, 10 Jun 2022 23:44:51 -0500 Subject: [PATCH] First time trying to fix a failed patch this way --- ...rown-when-trying-to-remove-minecart-.patch | 4 +-- ...-if-items-are-air-before-calling-set.patch | 4 +-- ...ate-BlockState-and-SoundEvent-values.patch | 32 +++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch diff --git a/patches/server/0008-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch b/patches/server/0008-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch index df38a66..7d66c7e 100644 --- a/patches/server/0008-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch +++ b/patches/server/0008-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -index ef50d9747f2a027e356b05ad8d94ffb2fd4a423e..cd8ede69be1f728663a670085113d842ec0209af 100644 +index b8fb7b5a347298ada16bc8b818edf1863e3f6040..7ec912bfec20d6b5d91f23341c4e9e3188d1236b 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -@@ -192,7 +192,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme +@@ -139,7 +139,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @Override public void remove(Entity.RemovalReason reason) { if (!this.level.isClientSide && reason.shouldDestroy()) { diff --git a/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch b/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch index e7105a7..2f8147a 100644 --- a/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch +++ b/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch @@ -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 9ca37cbf829ff4240ae79fc283bcf9e7f2c728d2..bc71ca6e082a137d17ee0bf43de72095bd19ab3d 100644 +index ae4b251e10babb07055d031ff48ac7dd5d4be4a0..36d57256c50fbd5e60c755ea47b608137d92ea50 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -379,11 +379,14 @@ public class ItemEntity extends Entity { +@@ -385,11 +385,14 @@ public class ItemEntity extends Entity { CompoundTag nbttagcompound1 = nbt.getCompound("Item"); diff --git a/patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch b/patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch new file mode 100644 index 0000000..c4f3a9b --- /dev/null +++ b/patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Video +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 5dda064813a0eb00438a7df909d51a4b2d48942e..29b8519a1dd954f004bf04145e7246e3d2592b77 100644 +--- a/src/main/java/net/minecraft/nbt/NbtUtils.java ++++ b/src/main/java/net/minecraft/nbt/NbtUtils.java +@@ -229,7 +229,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 bc01e5014e1355a225bdf5c47f2965290b45e2d2..8eba392e567afb069ae11b8e94ff72f0aa148ee9 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"));