Fix TNT not pushing creative players

This commit is contained in:
Professor Bloodstone 2020-08-25 20:46:04 +02:00 committed by MiniDigger
parent 915fe5225e
commit ef36b4f80c
3 changed files with 9 additions and 21 deletions

View File

@ -5,7 +5,7 @@ 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 bf910359de9365f51461ec1b80aaabdb24e26449..abc9eea66fed45db54e7b2a26ca8f7b05ca40e20 100644
index bf910359de9365f51461ec1b80aaabdb24e26449..8e7b9f11ee8a9010084960fb41a41eeadc06780e 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -154,7 +154,7 @@ public class Explosion {
@ -13,19 +13,7 @@ index bf910359de9365f51461ec1b80aaabdb24e26449..abc9eea66fed45db54e7b2a26ca8f7b0
int j1 = MathHelper.floor(this.posZ - (double) f2 - 1.0D);
int k1 = MathHelper.floor(this.posZ + (double) f2 + 1.0D);
- List<Entity> list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1));
+ List<Entity> list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> IEntitySelector.canAITarget().test(entity) && !entity.dead); // Paper - 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), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities
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 e8e7532493c973ce10d94a41676859674fc4e6f6..b88a99221933108141b558adef6aa91f0cedc136 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.isSpectator() && !((EntityHuman) entity).isCreative();
};

View File

@ -66,7 +66,7 @@ index 915378493d9c5bb501b21eb7aca380580716f4c3..8832ffc0fcf9410ecc07ac100c2c8e3c
return 0.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 7c239b95c9f8dfa76d397979e6b3fdcc9ff55022..aecb5ca746be20e31f047a68f729d5c5a3699140 100644
index 7c239b95c9f8dfa76d397979e6b3fdcc9ff55022..f0202dcb31fe637caa6bd998edec4cbc1def8324 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -3514,6 +3514,37 @@ public abstract class EntityLiving extends Entity {
@ -82,7 +82,7 @@ index 7c239b95c9f8dfa76d397979e6b3fdcc9ff55022..aecb5ca746be20e31f047a68f729d5c5
+ Vec3D direction = this.getLookDirection();
+ Vec3D end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance);
+
+ List<Entity> entityList = world.getEntities(this, getBoundingBox().expand(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).grow(1.0D, 1.0D, 1.0D), IEntitySelector.notSpectator().and(Entity::isInteractable));
+ List<Entity> entityList = world.getEntities(this, getBoundingBox().expand(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).grow(1.0D, 1.0D, 1.0D), IEntitySelector.canAITarget().and(Entity::isInteractable));
+
+ double distance = 0.0D;
+ MovingObjectPositionEntity result = null;
@ -108,14 +108,14 @@ index 7c239b95c9f8dfa76d397979e6b3fdcc9ff55022..aecb5ca746be20e31f047a68f729d5c5
public int getShieldBlockingDelay() {
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
index b88a99221933108141b558adef6aa91f0cedc136..c13bb708ccd14c3848afbc9afaf6439c1a574f22 100644
index e8e7532493c973ce10d94a41676859674fc4e6f6..50f342c5f6e1ee5865646af0327567d7005a9ca5 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -18,6 +18,7 @@ public final class IEntitySelector {
@@ -17,6 +17,7 @@ public final class IEntitySelector {
public static final Predicate<Entity> e = (entity) -> {
return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative();
};
+ public static Predicate<Entity> notSpectator() { return f; } // Paper - OBFHELPER
+ public static Predicate<Entity> canAITarget() { return f; } // Paper - OBFHELPER
public static final Predicate<Entity> f = (entity) -> {
return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL;
};

View File

@ -33,10 +33,10 @@ index 0605cb3e9873f92835e9f121b18c35e8eca5ccbb..550f80bfdbc8048c23789a2a89ecc946
return true;
}
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
index 3c296c81845c295c66854cb365f2061a7a7bbf23..06ce390b6492f23343e57e648bff241d96fdb7b6 100644
index b06f61639e52e6e5d2942f685cb3e3984a3eaec1..12cf4326594e1a13fa4f48903a7676a9dbb0aa87 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -26,6 +26,7 @@ public final class IEntitySelector {
@@ -25,6 +25,7 @@ public final class IEntitySelector {
public static final Predicate<Entity> g = (entity) -> {
return !entity.isSpectator();
};