2019-06-14 10:27:40 +08:00
|
|
|
From c52d35277cee8d0e03e323c2b717b510d667c1db Mon Sep 17 00:00:00 2001
|
2015-06-02 13:56:10 +08:00
|
|
|
From: Iceee <andrew@opticgaming.tv>
|
2016-03-01 07:09:49 +08:00
|
|
|
Date: Wed, 2 Mar 2016 01:39:52 -0600
|
2015-06-02 13:56:10 +08: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
|
2019-06-06 23:36:57 +08:00
|
|
|
index 462f8f33a1..e1c628f177 100644
|
2015-06-02 13:56:10 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/Explosion.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
2019-04-24 10:34:11 +08:00
|
|
|
@@ -146,7 +146,14 @@ public class Explosion {
|
2015-06-02 13:56:10 +08: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);
|
2019-01-01 11:15:55 +08:00
|
|
|
- List<Entity> list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1));
|
2016-03-01 07:09:49 +08:00
|
|
|
+ // Paper start - Fix lag from explosions processing dead entities
|
2019-01-01 11:15:55 +08:00
|
|
|
+ List<Entity> 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 13:56:10 +08:00
|
|
|
+ @Override
|
|
|
|
+ public boolean apply(Entity entity) {
|
2018-09-23 10:28:16 +08:00
|
|
|
+ return IEntitySelector.canAITarget().test(entity) && !entity.dead;
|
2015-06-02 13:56:10 +08:00
|
|
|
+ }
|
|
|
|
+ });
|
2016-03-01 07:09:49 +08:00
|
|
|
+ // Paper end
|
2015-06-02 13:56:10 +08:00
|
|
|
Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ);
|
|
|
|
|
|
|
|
for (int l1 = 0; l1 < list.size(); ++l1) {
|
2018-09-23 10:28:16 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
2019-06-06 23:36:57 +08:00
|
|
|
index e2744dc40d..9bf1919451 100644
|
2018-09-23 10:28:16 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
2019-01-01 11:15:55 +08:00
|
|
|
@@ -14,6 +14,7 @@ public final class IEntitySelector {
|
2018-09-23 10:28:16 +08:00
|
|
|
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) -> {
|
2019-06-03 11:26:25 +08:00
|
|
|
return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative();
|
2018-09-23 10:28:16 +08:00
|
|
|
};
|
2015-06-02 13:56:10 +08:00
|
|
|
--
|
2019-04-23 12:47:07 +08:00
|
|
|
2.21.0
|
2015-06-02 13:56:10 +08:00
|
|
|
|