2018-12-17 05:18:06 +00:00
From b45b30d876512ac7815531b094830438c30de107 Mon Sep 17 00:00:00 2001
2015-06-02 05:56:10 +00:00
From: Iceee <andrew@opticgaming.tv>
2016-02-29 23:09:49 +00:00
Date: Wed, 2 Mar 2016 01:39:52 -0600
2015-06-02 05:56:10 +00:00
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
2018-12-17 05:18:06 +00:00
index d564aaf60..92e3a49e2 100644
2015-06-02 05:56:10 +00:00
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
2018-08-26 18:11:49 +00:00
@@ -111,7 +111,14 @@ public class Explosion {
2015-06-02 05:56:10 +00:00
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));
2016-02-29 23:09:49 +00:00
+ // Paper start - Fix lag from explosions processing dead entities
2016-05-12 02:07:46 +00:00
+ 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<Entity>() {
2015-06-02 05:56:10 +00:00
+ @Override
+ public boolean apply(Entity entity) {
2018-09-23 02:28:16 +00:00
+ return IEntitySelector.canAITarget().test(entity) && !entity.dead;
2015-06-02 05:56:10 +00:00
+ }
+ });
2016-02-29 23:09:49 +00:00
+ // Paper end
2015-06-02 05:56:10 +00:00
Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ);
for (int l1 = 0; l1 < list.size(); ++l1) {
2018-09-23 02:28:16 +00:00
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
2018-12-17 05:18:06 +00:00
index 2e2fb85cf..7b7fd6b9b 100644
2018-09-23 02:28:16 +00:00
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -13,6 +13,7 @@ public final class IEntitySelector {
public static final Predicate<Entity> d = (entity) -> {
return entity instanceof IInventory && entity.isAlive();
};
+ public static Predicate<Entity> canAITarget() { return e; } // Paper - OBFHELPER
public static final Predicate<Entity> e = (entity) -> {
return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator() && !((EntityHuman)entity).u();
};
2018-12-17 05:18:06 +00:00
@@ -96,9 +97,5 @@ public final class IEntitySelector {
2018-09-23 02:28:16 +00:00
}
}
- // $FF: synthetic method
- public boolean test(@Nullable Object object) {
2018-12-17 05:18:06 +00:00
- return this.test((Entity)object);
- }
2018-09-23 02:28:16 +00:00
}
2018-12-17 05:18:06 +00:00
}
2015-06-02 05:56:10 +00:00
--
2018-12-17 05:18:06 +00:00
2.20.0
2015-06-02 05:56:10 +00:00