Files
LuminolMC/luminol-server/minecraft-patches/features/0021-Gale-Replace-AI-attributes-with-optimized-collection.patch
Helvetica Volubi d8a01345c6 Start 1.21.6
2025-06-23 00:13:00 +08:00

31 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Wed, 22 Jan 2025 17:18:00 +0800
Subject: [PATCH] Gale: Replace AI attributes with optimized collections
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
2No2Name <2No2Name@web.de>
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0087-Replace-AI-attributes-with-optimized-collections.patch)
Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index fdb02fc40579866167e8cc9bcefbd961588b53a6..58d8424262db14b2dca0b2c5a40748b6c0c18e83 100644
--- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -14,9 +14,11 @@ import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceLocation;
public class AttributeMap {
- private final Map<Holder<Attribute>, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>();
- private final Set<AttributeInstance> attributesToSync = new ObjectOpenHashSet<>();
- private final Set<AttributeInstance> attributesToUpdate = new ObjectOpenHashSet<>();
+ // Gale start - Lithium - replace AI attributes with optimized collections
+ private final Map<Holder<Attribute>, AttributeInstance> attributes = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(0);
+ private final Set<AttributeInstance> attributesToSync = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(0);
+ private final Set<AttributeInstance> attributesToUpdate = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(0);
+ // Gale end - Lithium - replace AI attributes with optimized collections
private final AttributeSupplier supplier;
public AttributeMap(AttributeSupplier supplier) {