Remove Moonrise utils to MCUtils, remove duplicated/unused utils

This commit is contained in:
Spottedleaf
2024-07-17 10:24:53 -07:00
parent e2a85cf6d9
commit cc8d4390d4
23 changed files with 3563 additions and 6467 deletions

View File

@@ -25,7 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package com.destroystokyo.paper.entity.ai;
+
+import com.destroystokyo.paper.entity.RangedEntity;
+import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import io.papermc.paper.util.ObfHelper;
@@ -316,7 +315,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static EnumSet<GoalType> vanillaToPaper(Goal goal) {
+ EnumSet<GoalType> goals = EnumSet.noneOf(GoalType.class);
+ for (GoalType type : GoalType.values()) {
+ if (goal.getFlags().contains(paperToVanilla(type))) {
+ if (goal.getFlags().hasElement(paperToVanilla(type))) {
+ goals.add(type);
+ }
+ }
@@ -422,7 +421,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ this.setFlags(MobGoalHelper.paperToVanilla(handle.getTypes()));
+ if (this.getFlags().size() == 0) {
+ this.getFlags().add(Flag.UNKNOWN_BEHAVIOR);
+ this.getFlags().addUnchecked(Flag.UNKNOWN_BEHAVIOR);
+ }
+ }
+
@@ -584,7 +583,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ CraftMob craftMob = (CraftMob) mob;
+ Set<Goal<T>> goals = new HashSet<>();
+ for (WrappedGoal item : getHandle(craftMob, type).getAvailableGoals()) {
+ if (!item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type))) {
+ if (!item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) {
+ continue;
+ }
+
@@ -607,7 +606,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ continue;
+ }
+ for (WrappedGoal item : getHandle(craftMob, internalType).getAvailableGoals()) {
+ if (item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type))) {
+ if (item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) {
+ continue;
+ }
+
@@ -637,7 +636,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Set<Goal<T>> goals = new HashSet<>();
+ getHandle(craftMob, type).getAvailableGoals()
+ .stream().filter(WrappedGoal::isRunning)
+ .filter(item -> item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type)))
+ .filter(item -> item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type)))
+ .forEach(item -> {
+ if (item.getGoal() instanceof PaperCustomGoal) {
+ //noinspection unchecked
@@ -660,7 +659,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ getHandle(craftMob, internalType).getAvailableGoals()
+ .stream()
+ .filter(WrappedGoal::isRunning)
+ .filter(item -> !item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type)))
+ .filter(item -> !item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type)))
+ .forEach(item -> {
+ if (item.getGoal() instanceof PaperCustomGoal) {
+ //noinspection unchecked