mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-29 03:49:21 +00:00
ClassInstanceMultiMap belongs to Minecraft vanilla entity storage. And is unused, since replaced by spottedleaf's entity storage (rewrite chunk system). However these patches might be useful for vanilla entity storage if is used.
25 lines
1.1 KiB
Diff
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++;
|