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

This commit is contained in:
Jason 2021-09-09 12:12:22 -05:00 committed by GitHub
parent 1b383d7e9b
commit 8a2b23a6a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 22 deletions

View file

@ -391,14 +391,13 @@ index 0000000000000000000000000000000000000000..181abe014baba9ac51064c003381281a
+}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java
new file mode 100644
index 0000000000000000000000000000000000000000..ddf1a34ef6aba584d30a5419a5109ad66385975c
index 0000000000000000000000000000000000000000..26c745dd9ccdfdd5c5039f2acc5201b9b91fb274
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java
@@ -0,0 +1,54 @@
@@ -0,0 +1,53 @@
+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..ddf1a34ef6aba584d30a5419a5109ad6
+ 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);
+ }
+ }
+
@ -451,7 +450,7 @@ index 0000000000000000000000000000000000000000..ddf1a34ef6aba584d30a5419a5109ad6
+}
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..52c86ed3abd411daf406aaab1dba409889d6c3e2
index 0000000000000000000000000000000000000000..336cc3c3b43bacf4f3661fa0bb0736b273f65418
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java
@@ -0,0 +1,213 @@
@ -566,7 +565,7 @@ index 0000000000000000000000000000000000000000..52c86ed3abd411daf406aaab1dba4098
+ 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..52c86ed3abd411daf406aaab1dba4098
+ 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..52c86ed3abd411daf406aaab1dba4098
+ 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..52c86ed3abd411daf406aaab1dba4098
+ 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
@ -670,7 +669,7 @@ index 0000000000000000000000000000000000000000..52c86ed3abd411daf406aaab1dba4098
+}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java
new file mode 100644
index 0000000000000000000000000000000000000000..6ab8ecb56d2ea885782a03d2ba3adbd9e3fd5642
index 0000000000000000000000000000000000000000..0d30e0b21b9024df939a9d070bd4a99b217e7c12
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java
@@ -0,0 +1,61 @@
@ -693,7 +692,7 @@ index 0000000000000000000000000000000000000000..6ab8ecb56d2ea885782a03d2ba3adbd9
+ 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() {
@ -749,7 +748,7 @@ index 9df0006c1a283f77c4d01d9fce9062fc1c9bbb1f..b3329c6fcd6758a781a51f5ba8f5052a
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java
index 8c2ec30a35e86f2b30863045b586a67e485c624b..848cac4426346b6d2ed575f33bf01c0e122acaa2 100644
index fabd20265863751ad980ee4a697f3f0d47df101f..3a4da2bb86a742985d309eb325dc843ae405cd8b 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java
@@ -6,6 +6,14 @@ public abstract class Goal {