diff options
Diffstat (limited to 'patches/server/0447-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch')
-rw-r--r-- | patches/server/0447-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/patches/server/0447-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/patches/server/0447-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch index 12172751cd..b254322735 100644 --- a/patches/server/0447-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch +++ b/patches/server/0447-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch @@ -8,7 +8,7 @@ This can realistically only happen if there's custom loot active on fishing which can return 0 items. This would disconnect the player who's fishing. diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 94bdd467108bc5fd0211f67a792787ef7c356619..f3694d432e280cace281eda95d8c2d4dd5d6930a 100644 +index 94bdd467108bc5fd0211f67a792787ef7c356619..b6ebae97dc863ba1748e9b32555f940077846be8 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -503,9 +503,15 @@ public class FishingHook extends Projectile { @@ -16,7 +16,7 @@ index 94bdd467108bc5fd0211f67a792787ef7c356619..f3694d432e280cace281eda95d8c2d4d while (iterator.hasNext()) { ItemStack itemstack1 = (ItemStack) iterator.next(); - ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemstack1); -+ // Paper start, new EntityItem would throw if for whatever reason (mostly shitty datapacks) the itemstack1 turns out to be empty ++ // Paper start - new ItemEntity would throw if for whatever reason (mostly shitty datapacks) the itemstack1 turns out to be empty + // if the item stack is empty we instead just have our entityitem as null + ItemEntity entityitem = null; + if (!itemstack1.isEmpty()) { @@ -35,7 +35,7 @@ index 94bdd467108bc5fd0211f67a792787ef7c356619..f3694d432e280cace281eda95d8c2d4d - entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D); - this.level().addFreshEntity(entityitem); -+ // Paper start, entity item can be null, so we need to check against this ++ // Paper start - entity item can be null, so we need to check against this + if (entityitem != null) { + entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D); + this.level().addFreshEntity(entityitem); |