9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-06 15:51:31 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0154-Direct-iteration-on-Sensing.tick.patch
2025-03-25 03:29:15 -04:00

30 lines
1.2 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] 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..2ea5095a4290f5236caad7ea30a59d9b3eb32aaa 100644
--- a/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -34,12 +34,16 @@ public class Sensing {
public void tick() {
if (this.expiring == null) { // Gale - Petal - reduce line of sight updates
- this.seen.clear();
+ this.seen.clear();
// Gale start - Petal - reduce line of sight updates
} else {
var expiringNow = this.expiring[this.nextToExpireIndex];
- expiringNow.forEach(this.seen::remove);
+ // Leaf - use direct iteration
+ var iterator = expiringNow.iterator();
+ while (iterator.hasNext()) {
+ this.seen.remove(iterator.nextInt());
+ }
expiringNow.clear();
this.currentCacheAddIndex++;