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/0114-Replace-brain-activity-maps-with-optimized-collectio.patch
2025-06-11 03:59:45 +08:00

22 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Sat, 8 Feb 2025 20:45:14 +0100
Subject: [PATCH] Replace brain activity maps with optimized collection
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index 778e3b99a7f941a53b87cbec510db8deed5d77c8..4dde1642a33349335f374f17123a700dde1079d7 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -390,8 +390,8 @@ public class Brain<E extends LivingEntity> {
for (Pair<Integer, ? extends BehaviorControl<? super E>> pair : tasks) {
this.availableBehaviorsByPriority
- .computeIfAbsent(pair.getFirst(), integer -> Maps.newHashMap())
- .computeIfAbsent(activity, activity1 -> Sets.newLinkedHashSet())
+ .computeIfAbsent(pair.getFirst(), integer -> new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>()) // Leaf - Replace brain activity maps with optimized collection
+ .computeIfAbsent(activity, activity1 -> new it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet<>()) // Leaf - Replace brain activity maps with optimized collection
.add((BehaviorControl<? super E>)pair.getSecond());
}
}