Paper/Spigot-Server-Patches/0031-Fix-lag-from-explosions-processing-dead-entities.patch
Zach Brown 70ce6ce831
Move version command update checking to the implementation
This makes it easier for downstream projects (forks) to replace the
version fetching system with their own. It is as simple as implementing
an interface and overriding the default implementation of
org.bukkit.UnsafeValues#getVersionFetcher()

It also makes it easier for us to organize things like the version
history feature.

Lastly I have updated the paper implementation to check against the site
API rather than against jenkins.
2019-05-27 04:13:41 -05:00

42 lines
2.2 KiB
Diff

From 3edf5fbf7fab81e91707ecd5feda12b3f91a0bfc Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
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 462f8f33a..e1c628f17 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -146,7 +146,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<Entity> 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<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>() {
+ @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 ac44db254..035d70419 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<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) || !entity.t() && !((EntityHuman) entity).isCreative();
};
--
2.21.0