Don't run entity collision code if not needed

This commit is contained in:
William Blake Galbreath
2020-04-02 02:12:30 -05:00
parent e154b96b66
commit 3482a81c1b

View File

@@ -0,0 +1,36 @@
From 0ddb705a9b56c7a1967ab659cfaad2094e441de1 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
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<Entity> 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