9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-20 23:39:32 +00:00
Files
SakuraMC/patches/server/0028-Optimise-LivingEntity-pushEntities.patch
Samsuik ac8701995c Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@906df69 Prevent internal NPE on ItemStack#damage (#10836)
PaperMC/Paper@79e2cb6 Update upstream (Bukkit/CraftBukkit/Spigot) (#10875)
2024-06-13 17:00:07 +01:00

24 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Thu, 23 Sep 2021 18:50:13 +0100
Subject: [PATCH] Optimise LivingEntity#pushEntities
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 21e61bb75ac7ce468bc757633ce678b21bcb9deb..a7bbd4d1ddb7e80724cdd05a6d6b37161e711264 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3554,7 +3554,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
return;
}
// Paper end - don't run getEntities if we're not going to use its result
- List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
+ // Sakura start - use maxEntityCollision limit for entity retrival
+ int limit = Math.max(i, this.level().paperConfig().collisions.maxEntityCollisions);
+ int search = limit * limit;
+ List<Entity> list = this.level().getLimitedEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule), limit, search); // Paper - Climbing should not bypass cramming gamerule
+ // Sakura end - use maxEntityCollision limit for entity retrival
if (!list.isEmpty()) {
// Paper - don't run getEntities if we're not going to use its result; moved up