From 3482a81c1bf3cd61f1169d700af3d18c658694de Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Thu, 2 Apr 2020 02:12:30 -0500 Subject: [PATCH] Don't run entity collision code if not needed --- ...-entity-collision-code-if-not-needed.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 patches/server/0120-Don-t-run-entity-collision-code-if-not-needed.patch diff --git a/patches/server/0120-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0120-Don-t-run-entity-collision-code-if-not-needed.patch new file mode 100644 index 000000000..58070f606 --- /dev/null +++ b/patches/server/0120-Don-t-run-entity-collision-code-if-not-needed.patch @@ -0,0 +1,36 @@ +From 0ddb705a9b56c7a1967ab659cfaad2094e441de1 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Thu, 26 Mar 2020 18:34:18 -0700 +Subject: [PATCH] Don't run entity collision code if not needed + +Will not run if max entity craming is disabled and +the max collisions per entity is less than or equal to 0 +--- + src/main/java/net/minecraft/server/EntityLiving.java | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 2769077bb4..a991614408 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -2689,10 +2689,16 @@ public abstract class EntityLiving extends Entity { + protected void doTick() {} + + protected void collideNearby() { ++ // Purpur start ++ int i = this.world.getGameRules().getInt(GameRules.MAX_ENTITY_CRAMMING); ++ if (i <= 0 && world.paperConfig.maxCollisionsPerEntity <= 0) { ++ return; ++ } ++ // Purpur end + List list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.pushable(this, world.purpurConfig.fixClimbingBypassingCrammingRule)); // Purpur + + if (!list.isEmpty()) { +- int i = this.world.getGameRules().getInt(GameRules.MAX_ENTITY_CRAMMING); ++ // int i = this.world.getGameRules().getInt(GameRules.MAX_ENTITY_CRAMMING); // Purpur - move up + int j; + + if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) { +-- +2.24.0 +