Remove method rename and fix reobf for Goal#getFlags (#6528)

This commit is contained in:
Jason Penilla 2021-09-09 12:12:22 -05:00
parent df51228b73
commit d3dab2f22c
3 changed files with 16 additions and 14 deletions

View file

@ -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

View file

@ -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<Goal<T>> 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<Goal<T>> 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() {

View file

@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public EnumSet<Goal.Flag> getFlags() {
- return this.flags;
+ // Paper start - remove streams from pathfindergoalselector
+ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<Goal.Flag> getGoalTypes() {
+ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<Goal.Flag> 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<net.minecraft.world.entity.ai.goal.Goal.Flag> wrappedGoalSet = wrappedGoal.getGoalTypes();
+ com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> wrappedGoalSet = wrappedGoal.getFlags();
+
+ if (this.goalTypes.hasCommonElements(wrappedGoalSet)) {
+ continue;
@ -214,10 +214,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- @Override
- public EnumSet<Goal.Flag> getFlags() {
- return this.goal.getFlags();
+ // Paper start - remove streams from pathfindergoalselector
+ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<Goal.Flag> getGoalTypes() {
+ return this.goal.getGoalTypes();
+ public com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() {
return this.goal.getFlags();
+ // Paper end - remove streams from pathfindergoalselector
}