From 6298f2d72de6b88b59b1e49f27c7dd1051f2406a Mon Sep 17 00:00:00 2001 From: Iceee Date: Wed, 2 Mar 2016 01:39:52 -0600 Subject: [PATCH] Fix lag from explosions processing dead entities diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index 33809baf2e..c4db6367e9 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -111,7 +111,14 @@ public class Explosion { int i1 = MathHelper.floor(this.posY + (double) f3 + 1.0D); int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D); int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D); - List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1)); + // Paper start - Fix lag from explosions processing dead entities + List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate() { + @Override + public boolean apply(Entity entity) { + return IEntitySelector.canAITarget().test(entity) && !entity.dead; + } + }); + // Paper end Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ); for (int l1 = 0; l1 < list.size(); ++l1) { diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java index 8225a82582..bbcbb62325 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -14,6 +14,7 @@ public final class IEntitySelector { public static final Predicate d = (entity) -> { return entity instanceof IInventory && entity.isAlive(); }; + public static Predicate canAITarget() { return e; } // Paper - OBFHELPER public static final Predicate e = (entity) -> { return !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator() && !((EntityHuman) entity).u(); }; -- 2.21.0