From d3dab2f22c423c5345c533736af34193aa5b0474 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Thu, 9 Sep 2021 12:12:22 -0500 Subject: [PATCH] Remove method rename and fix reobf for Goal#getFlags (#6528) --- build-data/reobf-mappings-patch.tiny | 4 ++++ patches/server/Implement-Mob-Goal-API.patch | 15 +++++++-------- .../Remove-streams-from-Mob-AI-System.patch | 11 +++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/build-data/reobf-mappings-patch.tiny b/build-data/reobf-mappings-patch.tiny index 53640748fc..355733ef7e 100644 --- a/build-data/reobf-mappings-patch.tiny +++ b/build-data/reobf-mappings-patch.tiny @@ -48,3 +48,7 @@ c net/minecraft/world/level/Level net/minecraft/world/level/World # Paper changes type c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw + +# Remove streams from Mob AI System changes type from EnumSet to com.destroystokyo.paper.util.set.OptimizedSmallEnumSet +c net/minecraft/world/entity/ai/goal/Goal net/minecraft/world/entity/ai/goal/PathfinderGoal + m ()Lcom/destroystokyo/paper/util/set/OptimizedSmallEnumSet; getFlags i diff --git a/patches/server/Implement-Mob-Goal-API.patch b/patches/server/Implement-Mob-Goal-API.patch index d9fd80bac6..465f0d0e40 100644 --- a/patches/server/Implement-Mob-Goal-API.patch +++ b/patches/server/Implement-Mob-Goal-API.patch @@ -398,7 +398,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package com.destroystokyo.paper.entity.ai; + +import org.bukkit.entity.Mob; -+import com.destroystokyo.paper.entity.ai.Goal; + +/** + * Wraps api in vanilla @@ -411,8 +410,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.handle = handle; + + this.setFlags(MobGoalHelper.paperToVanilla(handle.getTypes())); -+ if (this.getGoalTypes().size() == 0) { -+ this.getGoalTypes().addUnchecked(Flag.UNKNOWN_BEHAVIOR); ++ if (this.getFlags().size() == 0) { ++ this.getFlags().addUnchecked(Flag.UNKNOWN_BEHAVIOR); + } + } + @@ -566,7 +565,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CraftMob craftMob = (CraftMob) mob; + Set> goals = new HashSet<>(); + for (WrappedGoal item : getHandle(craftMob, type).availableGoals) { -+ if (!item.getGoal().getGoalTypes().hasElement(MobGoalHelper.paperToVanilla(type))) { ++ if (!item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) { + continue; + } + @@ -589,7 +588,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + continue; + } + for (WrappedGoal item : getHandle(craftMob, internalType).availableGoals) { -+ if (item.getGoal().getGoalTypes().hasElement(MobGoalHelper.paperToVanilla(type))) { ++ if (item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) { + continue; + } + @@ -618,7 +617,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CraftMob craftMob = (CraftMob) mob; + Set> goals = new HashSet<>(); + getHandle(craftMob, type).getRunningGoals() -+ .filter(item -> item.getGoal().getGoalTypes().hasElement(MobGoalHelper.paperToVanilla(type))) ++ .filter(item -> item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) + .forEach(item -> { + if (item.getGoal() instanceof PaperCustomGoal) { + //noinspection unchecked @@ -639,7 +638,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + continue; + } + getHandle(craftMob, internalType).getRunningGoals() -+ .filter(item -> !item.getGoal().getGoalTypes().hasElement(MobGoalHelper.paperToVanilla(type))) ++ .filter(item -> !item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) + .forEach(item -> { + if (item.getGoal() instanceof PaperCustomGoal) { + //noinspection unchecked @@ -693,7 +692,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public PaperVanillaGoal(Goal handle) { + this.handle = handle; + this.key = MobGoalHelper.getKey(handle.getClass()); -+ this.types = MobGoalHelper.vanillaToPaper(handle.getGoalTypes()); ++ this.types = MobGoalHelper.vanillaToPaper(handle.getFlags()); + } + + public Goal getHandle() { diff --git a/patches/server/Remove-streams-from-Mob-AI-System.patch b/patches/server/Remove-streams-from-Mob-AI-System.patch index 135ebfb0fb..d45bd20ff8 100644 --- a/patches/server/Remove-streams-from-Mob-AI-System.patch +++ b/patches/server/Remove-streams-from-Mob-AI-System.patch @@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public EnumSet getFlags() { - return this.flags; + // Paper start - remove streams from pathfindergoalselector -+ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet getGoalTypes() { ++ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet getFlags() { + return this.goalTypes; + // Paper end - remove streams from pathfindergoalselector } @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.lockedFlags.remove(flag); + continue; + } -+ if (!this.goalTypes.hasCommonElements(wrappedGoal.getGoalTypes()) && wrappedGoal.canContinueToUse()) { ++ if (!this.goalTypes.hasCommonElements(wrappedGoal.getFlags()) && wrappedGoal.canContinueToUse()) { + continue; + } + wrappedGoal.stop(); @@ -141,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + continue; + } + -+ com.destroystokyo.paper.util.set.OptimizedSmallEnumSet wrappedGoalSet = wrappedGoal.getGoalTypes(); ++ com.destroystokyo.paper.util.set.OptimizedSmallEnumSet wrappedGoalSet = wrappedGoal.getFlags(); + + if (this.goalTypes.hasCommonElements(wrappedGoalSet)) { + continue; @@ -214,10 +214,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - @Override - public EnumSet getFlags() { -- return this.goal.getFlags(); + // Paper start - remove streams from pathfindergoalselector -+ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet getGoalTypes() { -+ return this.goal.getGoalTypes(); ++ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet getFlags() { + return this.goal.getFlags(); + // Paper end - remove streams from pathfindergoalselector }