From 0585f99b0522761871fb714f4a64f39acc1451b2 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 14 Dec 2019 01:11:59 +0000 Subject: [PATCH] Prevent TRAP while loading Fireballs --- Spigot-Server-Patches/0003-MC-Dev-fixes.patch | 17 ++++++++++++-- ...Prevent-TRAP-while-loading-Fireballs.patch | 22 +++++++++++++++++++ scripts/importmcdev.sh | 1 + 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Spigot-Server-Patches/0411-Prevent-TRAP-while-loading-Fireballs.patch diff --git a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch index d2889e126..2d4a1cc8e 100644 --- a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch @@ -1,4 +1,4 @@ -From cabe477c5c143734d6b8242e4ab82203ca85a2b6 Mon Sep 17 00:00:00 2001 +From 499a94be3e76d1a2ed87c18bad399d0543c5ded7 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes @@ -156,6 +156,19 @@ index f2c0e06ba..909d13c42 100644 } private EntityEnderDragon o() { +diff --git a/src/main/java/net/minecraft/server/EntityFireballFireball.java b/src/main/java/net/minecraft/server/EntityFireballFireball.java +index 8e28c4725..3988e68d4 100644 +--- a/src/main/java/net/minecraft/server/EntityFireballFireball.java ++++ b/src/main/java/net/minecraft/server/EntityFireballFireball.java +@@ -18,7 +18,7 @@ public abstract class EntityFireballFireball extends EntityFireball { + + public void b(ItemStack itemstack) { + if (itemstack.getItem() != Items.FIRE_CHARGE || itemstack.hasTag()) { +- this.getDataWatcher().set(EntityFireballFireball.f, SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> { ++ this.getDataWatcher().set(EntityFireballFireball.f, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // Paper - decompile fix + itemstack1.setCount(1); + })); + } diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java index 7d44348c7..73ecdd22e 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java @@ -622,5 +635,5 @@ index 55fe7625a..19e68a783 100644 t0.a(nbttagcompound.getCompound("data")); -- -2.24.0 +2.24.1 diff --git a/Spigot-Server-Patches/0411-Prevent-TRAP-while-loading-Fireballs.patch b/Spigot-Server-Patches/0411-Prevent-TRAP-while-loading-Fireballs.patch new file mode 100644 index 000000000..755393d0b --- /dev/null +++ b/Spigot-Server-Patches/0411-Prevent-TRAP-while-loading-Fireballs.patch @@ -0,0 +1,22 @@ +From 2515940c05e1f56035eb8ffd09f9848faf312900 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sat, 14 Dec 2019 01:10:45 +0000 +Subject: [PATCH] Prevent TRAP while loading Fireballs + + +diff --git a/src/main/java/net/minecraft/server/EntityFireballFireball.java b/src/main/java/net/minecraft/server/EntityFireballFireball.java +index 3988e68d4..a16b756a0 100644 +--- a/src/main/java/net/minecraft/server/EntityFireballFireball.java ++++ b/src/main/java/net/minecraft/server/EntityFireballFireball.java +@@ -19,7 +19,7 @@ public abstract class EntityFireballFireball extends EntityFireball { + public void b(ItemStack itemstack) { + if (itemstack.getItem() != Items.FIRE_CHARGE || itemstack.hasTag()) { + this.getDataWatcher().set(EntityFireballFireball.f, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // Paper - decompile fix +- itemstack1.setCount(1); ++ if(!itemstack1.isEmpty()) itemstack1.setCount(1); // Paper + })); + } + +-- +2.24.1 + diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 227a01eab..08c66e841 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -93,6 +93,7 @@ done # we do not need any lines added to this file for NMS # import FileName +import EntityFireballFireball