Implement Mob Goal API
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/Goal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/Goal.java
|
||||
@@ -46,6 +46,16 @@
|
||||
return this.flags;
|
||||
}
|
||||
|
||||
+ // Paper start - Mob Goal API
|
||||
+ public boolean hasFlag(final Goal.Flag flag) {
|
||||
+ return this.flags.contains(flag);
|
||||
+ }
|
||||
+
|
||||
+ public void addFlag(final Goal.Flag flag) {
|
||||
+ this.flags.add(flag);
|
||||
+ }
|
||||
+ // Paper end - Mob Goal API
|
||||
+
|
||||
protected int adjustedTickDelay(int ticks) {
|
||||
return this.requiresUpdateEveryTick() ? ticks : reducedTickDelay(ticks);
|
||||
}
|
||||
@@ -62,7 +72,19 @@
|
||||
return (ServerLevel)world;
|
||||
}
|
||||
|
||||
+ // Paper start - Mob goal api
|
||||
+ private com.destroystokyo.paper.entity.ai.PaperVanillaGoal<?> vanillaGoal;
|
||||
+ public <T extends org.bukkit.entity.Mob> com.destroystokyo.paper.entity.ai.Goal<T> asPaperVanillaGoal() {
|
||||
+ if(this.vanillaGoal == null) {
|
||||
+ this.vanillaGoal = new com.destroystokyo.paper.entity.ai.PaperVanillaGoal<>(this);
|
||||
+ }
|
||||
+ //noinspection unchecked
|
||||
+ return (com.destroystokyo.paper.entity.ai.Goal<T>) this.vanillaGoal;
|
||||
+ }
|
||||
+ // Paper end - Mob goal api
|
||||
+
|
||||
public static enum Flag {
|
||||
+ UNKNOWN_BEHAVIOR, // Paper - add UNKNOWN_BEHAVIOR
|
||||
MOVE,
|
||||
LOOK,
|
||||
JUMP,
|
||||
Reference in New Issue
Block a user