Yatopia/patches/Tuinity/patches/server/0026-Reduce-allocation-rate...

34 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Wed, 27 May 2020 14:26:26 -0700
Subject: [PATCH] Reduce allocation rate from crammed entities
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 7b5bb97d410e20d3aa6b9222e4f8ad878e667bc8..365066cd7844261c5d437db17ebd61d0631ca140 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2857,7 +2857,11 @@ public abstract class EntityLiving extends Entity {
return;
}
// Paper - end don't run getEntities if we're not going to use its result
- List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.pushable(this, world.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
+ // Tuinity start - reduce memory allocation from collideNearby
+ List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList();
+ this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.pushable(this, world.paperConfig.fixClimbingBypassingCrammingRule), list); // Paper - fix climbing bypassing cramming rule
+ try {
+ // Tuinity end - reduce memory allocation from collideNearby
if (!list.isEmpty()) {
// Paper - move up
@@ -2886,6 +2890,9 @@ public abstract class EntityLiving extends Entity {
this.C(entity);
}
}
+ } finally { // Tuinity start - reduce memory allocation from collideNearby
+ com.tuinity.tuinity.util.CachedLists.returnTempGetEntitiesList(list);
+ } // Tuinity end - reduce memory allocation from collideNearby
}