9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0218-Use-direct-iteration-on-Sensing.tick.patch
hayanesuru 23b7b02eee optimize chunk map (#438)
* rebase

* optimize LivingEntity#travel

* cleanup

* Replace fluid height map

* reuse array list in Entity#collide

* cleanup

* fix fire and liquid collision shape

* fix checkInside

* inline betweenClosed

* cleanup

* optimize getOnPos

* optimize equals in getOnPos

* update mainSupportingBlockPos on dirty

* cleanup

* rename

* merge same patch

* rebase and remove properly

* [ci skip] cleanup

* rebase and rebuild

* fix async locator

* remove async locator

* cleanup

* rebase

---------

Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
2025-08-19 20:48:26 +02:00

25 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Sun, 23 Mar 2025 20:48:16 +0100
Subject: [PATCH] Use direct iteration on Sensing.tick
diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java
index cc25f5838aec5ed9fca2fb8b0322fafad9397a46..002d3c0d8b1107a275020d5c582c37e9a5c536ee 100644
--- a/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -39,7 +39,12 @@ public class Sensing {
} else {
var expiringNow = this.expiring[this.nextToExpireIndex];
- expiringNow.forEach(this.seen::remove);
+ // Leaf start - Use direct iteration on Sensing.tick
+ var iterator = expiringNow.iterator();
+ while (iterator.hasNext()) {
+ this.seen.remove(iterator.nextInt());
+ }
+ // Leaf end - Use direct iteration on Sensing.tick
expiringNow.clear();
this.currentCacheAddIndex++;