AT bullshit

This commit is contained in:
MiniDigger 2021-06-16 00:24:12 +02:00
commit 3fb6b93f96
65 changed files with 340 additions and 787 deletions

View file

@ -565,7 +565,7 @@ index 0000000000000000000000000000000000000000..ee500489fca34c339175b5209ebcf341
+}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java
new file mode 100644
index 0000000000000000000000000000000000000000..a17a8d8ced942e6e3f9072f199c75391dd57dc6a
index 0000000000000000000000000000000000000000..2f9e87d37a8ca794b12098232836295aadd80aff
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java
@@ -0,0 +1,221 @@
@ -603,7 +603,7 @@ index 0000000000000000000000000000000000000000..a17a8d8ced942e6e3f9072f199c75391
+ getHandle(craftMob, goal.getTypes()).removeGoal(((PaperVanillaGoal<?>) goal).getHandle());
+ } else {
+ List<net.minecraft.world.entity.ai.goal.Goal> toRemove = new LinkedList<>();
+ for (WrappedGoal item : getHandle(craftMob, goal.getTypes()).availableGoals()) {
+ for (WrappedGoal item : getHandle(craftMob, goal.getTypes()).availableGoals) {
+ if (item.getGoal() instanceof PaperCustomGoal) {
+ //noinspection unchecked
+ if (((PaperCustomGoal<T>) item.getGoal()).getHandle() == goal) {
@ -683,7 +683,7 @@ index 0000000000000000000000000000000000000000..a17a8d8ced942e6e3f9072f199c75391
+ public <T extends Mob> Collection<Goal<T>> getAllGoals(T mob, GoalType type) {
+ CraftMob craftMob = (CraftMob) mob;
+ Set<Goal<T>> goals = new HashSet<>();
+ for (WrappedGoal item : getHandle(craftMob, type).availableGoals()) {
+ for (WrappedGoal item : getHandle(craftMob, type).availableGoals) {
+ if (!item.getGoal().getGoalTypes().hasElement(MobGoalHelper.paperToVanilla(type))) {
+ continue;
+ }
@ -707,7 +707,7 @@ index 0000000000000000000000000000000000000000..a17a8d8ced942e6e3f9072f199c75391
+ if (internalType == type) {
+ continue;
+ }
+ for (WrappedGoal item : getHandle(craftMob, internalType).availableGoals()) {
+ for (WrappedGoal item : getHandle(craftMob, internalType).availableGoals) {
+ if (item.getGoal().getGoalTypes().hasElement(MobGoalHelper.paperToVanilla(type))) {
+ continue;
+ }
@ -919,19 +919,6 @@ index 8c2ec30a35e86f2b30863045b586a67e485c624b..a20faf55488baa31d7f8bf8231e3e825
MOVE,
LOOK,
JUMP,
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 bcb2c5480872eef6f21746003380f71b8d44f5c8..bcd0da029edd9b1d6f3617ee20dac00c9890ae82 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
@@ -26,7 +26,7 @@ public class GoalSelector {
}
};
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
- private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
+ private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet(); public final Set<WrappedGoal> availableGoals() { return this.availableGoals; } // Paper - public getter
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
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 130ab05393a7136020e06ec199256a031ba66091..8dd93620a770855450ed222dad6572e20760b08c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java