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/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 2537c9fcf155253da53ada3829c3caca765f35f4..96cc46a26eef701b0579f3407e67af9176e1743b 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -2973,7 +2973,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
@@ -3002,6 +3006,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
}