30 lines
2.0 KiB
Diff
30 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: 2No2Name <2No2Name@web.de>
|
|
Date: Sun, 12 Dec 2021 16:41:06 -0500
|
|
Subject: [PATCH] lithium: replace AI goal set with optimized collection
|
|
|
|
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
|
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
index 289b78ca3e587ffd42a920b99cbe5078a0d787a4..2834196fa116bdd629adaac010b30e980719d653 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
@@ -12,6 +12,7 @@ import java.util.function.Supplier;
|
|
import java.util.stream.Stream;
|
|
import net.minecraft.util.profiling.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; // Lithium
|
|
|
|
public class GoalSelector {
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
@@ -27,7 +28,7 @@ public class GoalSelector {
|
|
}
|
|
};
|
|
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
|
|
- public final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
|
|
+ public final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>(); // Lithium - replace AI goal set with optimized collection
|
|
private final Supplier<ProfilerFiller> profiler;
|
|
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
|
|
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
|