mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
f17519338b
* Expose server build information * squash patches * final tweaks --------- Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: masmc05 <masmc05@gmail.com>
44 lines
2.4 KiB
Diff
44 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 22 Jan 2017 18:07:56 -0500
|
|
Subject: [PATCH] Cap Entity Collisions
|
|
|
|
Limit a single entity to colliding a max of configurable times per tick.
|
|
This will alleviate issues where living entities are hoarded in 1x1 pens
|
|
|
|
This is not tied to the maxEntityCramming rule. Cramming will still apply
|
|
just as it does in Vanilla, but entity pushing logic will be capped.
|
|
|
|
You can set this to 0 to disable collisions.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index e04c0d333f8a425e4a1315b20f182b2206c22277..1bdf39894b4224d38fb3141e6445f6782b4e1920 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -396,6 +396,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
public long activatedTick = Integer.MIN_VALUE;
|
|
public void inactiveTick() { }
|
|
// Spigot end
|
|
+ protected int numCollisions = 0; // Paper - Cap entity collisions
|
|
// Paper start - Entity origin API
|
|
@javax.annotation.Nullable
|
|
private org.bukkit.util.Vector origin;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 1379f0ba7cf99e7829aaaca62ac4c56c359f6bf0..894772009bd3ca2615297b6ca856a9ffe23f3c42 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3460,10 +3460,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
Iterator iterator1 = list.iterator();
|
|
+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper - Cap entity collisions
|
|
|
|
- while (iterator1.hasNext()) {
|
|
+ while (iterator1.hasNext() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions) { // Paper - Cap entity collisions
|
|
Entity entity1 = (Entity) iterator1.next();
|
|
-
|
|
+ entity1.numCollisions++; // Paper - Cap entity collisions
|
|
+ this.numCollisions++; // Paper - Cap entity collisions
|
|
this.doPush(entity1);
|
|
}
|
|
}
|