mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
faster maps for brain
This commit is contained in:
@@ -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
|
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
|
||||||
index 083eb9a7a0bc14d30db944f356d98ca552fa1784..c561b749fb9b76ba9b1e9689089b743248c65d50 100644
|
index 083eb9a7a0bc14d30db944f356d98ca552fa1784..778e3b99a7f941a53b87cbec510db8deed5d77c8 100644
|
||||||
--- a/net/minecraft/world/entity/ai/Brain.java
|
--- a/net/minecraft/world/entity/ai/Brain.java
|
||||||
+++ b/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> {
|
@@ -45,14 +45,18 @@ public class Brain<E extends LivingEntity> {
|
||||||
@@ -14,11 +14,12 @@ index 083eb9a7a0bc14d30db944f356d98ca552fa1784..c561b749fb9b76ba9b1e9689089b7432
|
|||||||
private static final int SCHEDULE_UPDATE_DELAY = 20;
|
private static final int SCHEDULE_UPDATE_DELAY = 20;
|
||||||
- private final Map<MemoryModuleType<?>, Optional<? extends ExpirableValue<?>>> memories = Maps.newHashMap();
|
- 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<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
|
+ // Leaf start - Replace brain maps with optimized collection
|
||||||
+ private final Map<MemoryModuleType<?>, Optional<? extends ExpirableValue<?>>> memories = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>();
|
+ 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.Object2ObjectLinkedOpenHashMap<>();
|
+ 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 = new it.unimi.dsi.fastutil.objects.Object2ObjectRBTreeMap<>();
|
||||||
+ // Leaf end - Replace brain maps with optimized collection
|
+ // Leaf end - Replace brain maps with optimized collection
|
||||||
private final Map<Integer, Map<Activity, Set<BehaviorControl<? super E>>>> availableBehaviorsByPriority = Maps.newTreeMap();
|
|
||||||
private Schedule schedule = Schedule.EMPTY;
|
private Schedule schedule = Schedule.EMPTY;
|
||||||
- private final Map<Activity, Set<Pair<MemoryModuleType<?>, MemoryStatus>>> activityRequirements = Maps.newHashMap();
|
- private final Map<Activity, Set<Pair<MemoryModuleType<?>, MemoryStatus>>> activityRequirements = Maps.newHashMap();
|
||||||
- private final Map<Activity, Set<MemoryModuleType<?>>> activityMemoriesToEraseWhenStopped = Maps.newHashMap();
|
- private final Map<Activity, Set<MemoryModuleType<?>>> activityMemoriesToEraseWhenStopped = Maps.newHashMap();
|
||||||
|
|||||||
Reference in New Issue
Block a user