9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

fix it when it's off too

This commit is contained in:
Taiyou06
2025-06-13 09:54:39 +02:00
parent 15ef4ca901
commit df7eef099c

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Replace brain maps with optimized collection
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index 083eb9a7a0bc14d30db944f356d98ca552fa1784..0f50db187e04582e9b66a63201af987f6db74939 100644
index 083eb9a7a0bc14d30db944f356d98ca552fa1784..10986e50bd3307f81074c4cb371eb4d7defc9cfc 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -45,14 +45,18 @@ public class Brain<E extends LivingEntity> {
@@ -14,11 +14,10 @@ index 083eb9a7a0bc14d30db944f356d98ca552fa1784..0f50db187e04582e9b66a63201af987f
private static final int SCHEDULE_UPDATE_DELAY = 20;
- private final Map<MemoryModuleType<?>, Optional<? extends ExpirableValue<?>>> memories = Maps.newHashMap();
- private final Map<SensorType<? extends Sensor<? super E>>, Sensor<? super E>> sensors = Maps.newLinkedHashMap();
- private final Map<Integer, Map<Activity, Set<BehaviorControl<? super E>>>> availableBehaviorsByPriority = Maps.newTreeMap();
+ // Leaf start - Replace brain maps with optimized collection
+ private final Map<MemoryModuleType<?>, Optional<? extends ExpirableValue<?>>> memories = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>();
+ private final Map<SensorType<? extends Sensor<? super E>>, Sensor<? super E>> sensors = new it.unimi.dsi.fastutil.objects.Reference2ReferenceLinkedOpenHashMap<>();
+ private final Map<Integer, Map<Activity, Set<BehaviorControl<? super E>>>> availableBehaviorsByPriority = org.dreeam.leaf.config.modules.async.MultithreadedTracker.compatModeEnabled ? Maps.newTreeMap() : new it.unimi.dsi.fastutil.objects.Object2ObjectRBTreeMap<>();
private final Map<Integer, Map<Activity, Set<BehaviorControl<? super E>>>> availableBehaviorsByPriority = Maps.newTreeMap();
+ // Leaf end - Replace brain maps with optimized collection
private Schedule schedule = Schedule.EMPTY;
- private final Map<Activity, Set<Pair<MemoryModuleType<?>, MemoryStatus>>> activityRequirements = Maps.newHashMap();