diff options
Diffstat (limited to 'Spigot-Server-Patches/0206-Cap-Entity-Collisions.patch')
-rw-r--r-- | Spigot-Server-Patches/0206-Cap-Entity-Collisions.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0206-Cap-Entity-Collisions.patch b/Spigot-Server-Patches/0206-Cap-Entity-Collisions.patch new file mode 100644 index 0000000000..03fbb17253 --- /dev/null +++ b/Spigot-Server-Patches/0206-Cap-Entity-Collisions.patch @@ -0,0 +1,60 @@ +From f9ef38071405f1b311bf12dacd221d2b17fe298c Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 61efcc47..4898e8bc 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -408,4 +408,10 @@ public class PaperWorldConfig { + private void armorStandEntityLookups() { + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); + } ++ ++ public int maxCollisionsPerEntity; ++ private void maxEntityCollision() { ++ maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) ); ++ log( "Max Entity Collisions: " + maxCollisionsPerEntity ); ++ } + } +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 6fcced92..cfeff7c4 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -168,6 +168,7 @@ public abstract class Entity implements ICommandListener { + public final boolean defaultActivationState; + public long activatedTick = Integer.MIN_VALUE; + public boolean fromMobSpawner; ++ protected int numCollisions = 0; // Paper + public void inactiveTick() { } + // Spigot end + +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 7242da9c..53486e20 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -2132,8 +2132,11 @@ public abstract class EntityLiving extends Entity { + } + } + +- for (j = 0; j < list.size(); ++j) { ++ numCollisions = Math.max(0, numCollisions - world.paperConfig.maxCollisionsPerEntity); // Paper ++ for (j = 0; j < list.size() && numCollisions < world.paperConfig.maxCollisionsPerEntity; ++j) { // Paper + Entity entity = (Entity) list.get(j); ++ entity.numCollisions++; // Paper ++ numCollisions++; // Paper + + this.C(entity); + } +-- +2.12.2 + |