From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Sat, 6 Apr 2024 05:17:42 +0000 Subject: [PATCH] Gale Replace AI attributes with optimized collections diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java index 8d6954d05d2bf6d6c1c4953db3127b011a858cec..0ddb031bfe8df351f1cf97d258f81558e4719dbf 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java @@ -1,8 +1,6 @@ package net.minecraft.world.entity.ai.attributes; -import com.google.common.collect.Maps; import com.google.common.collect.Multimap; -import com.google.common.collect.Sets; import com.mojang.logging.LogUtils; import java.util.Collection; import java.util.Map; @@ -10,6 +8,9 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; import javax.annotation.Nullable; + +import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import net.minecraft.Util; import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; @@ -20,8 +21,10 @@ import org.slf4j.Logger; public class AttributeMap { private static final Logger LOGGER = LogUtils.getLogger(); - private final Map attributes = Maps.newHashMap(); - private final Set dirtyAttributes = Sets.newHashSet(); + // Gale start - Lithium - replace AI attributes with optimized collections + private final Map attributes = new Reference2ReferenceOpenHashMap<>(0); + private final Set dirtyAttributes = new ReferenceOpenHashSet<>(0); + // Gale end - Lithium - replace AI attributes with optimized collections private final AttributeSupplier supplier; private final java.util.function.Function createInstance; // Pufferfish