Archiviert
13
0

Review EntityPathfindEvent

Add missing target forward
Dieser Commit ist enthalten in:
Spottedleaf 2019-05-12 18:39:06 -07:00 committet von Zach
Ursprung a2db4c09a2
Commit da850bab55
4 geänderte Dateien mit 37 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -1,12 +1,25 @@
From ef812432ec5d1a861add26683b2236d6e3cbcb25 Mon Sep 17 00:00:00 2001
From 790dff9ff673058b18a3c92bddced6e2cb179981 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 21:22:26 -0400
Subject: [PATCH] EntityPathfindEvent
Fires when an Entity decides to start moving to a location.
diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java
index 79b2d9297..b6e3bf823 100644
--- a/src/main/java/net/minecraft/server/Navigation.java
+++ b/src/main/java/net/minecraft/server/Navigation.java
@@ -60,7 +60,7 @@ public class Navigation extends NavigationAbstract {
@Override
public PathEntity a(Entity entity) {
- return this.b(new BlockPosition(entity));
+ return this.b(new BlockPosition(entity), entity); // Paper - Forward target entity
}
private int s() {
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 2ced8dedd..6ce35018a 100644
index 2ced8dedd..7b27251b3 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -4,7 +4,7 @@ import javax.annotation.Nullable;
@ -18,15 +31,15 @@ index 2ced8dedd..6ce35018a 100644
protected final World b;
@Nullable
protected PathEntity c;
@@ -71,13 +71,16 @@ public abstract class NavigationAbstract {
@@ -71,13 +71,15 @@ public abstract class NavigationAbstract {
return this.b(new BlockPosition(d0, d1, d2));
}
- @Nullable
- public PathEntity b(BlockPosition blockposition) {
+ // Paper start - Add target entity parameter for path find event
+ @Nullable public PathEntity b(BlockPosition blockposition) { return this.b(blockposition, null); }
@Nullable
- public PathEntity b(BlockPosition blockposition) {
+ public PathEntity b(BlockPosition blockposition, Entity target) {
+ @Nullable public PathEntity b(BlockPosition blockposition, Entity target) {
+ // Paper end
float f = (float) blockposition.getX() + 0.5F;
float f1 = (float) blockposition.getY() + 0.5F;
@ -37,7 +50,7 @@ index 2ced8dedd..6ce35018a 100644
}
@Nullable
@@ -87,16 +90,25 @@ public abstract class NavigationAbstract {
@@ -87,16 +89,24 @@ public abstract class NavigationAbstract {
double d1 = entity.getBoundingBox().minY;
double d2 = entity.locZ;
@ -45,11 +58,11 @@ index 2ced8dedd..6ce35018a 100644
+ return this.a(blockposition, entity, d0, d1, d2, 16, true); // Paper - Path find event
}
- @Nullable
- protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) {
+ // Paper start - Add target entity parameter for path find event
+ @Nullable protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) { return this.a(blockposition, null, d0, d1, d2, i, flag); }
@Nullable
- protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) {
+ protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
+ @Nullable protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
+ // Paper end
if (!this.a()) {
return null;

Datei anzeigen

@ -1,4 +1,4 @@
From 61f8cebe436377f8f237d12f4ac12cec64677d25 Mon Sep 17 00:00:00 2001
From 6e7c5c35348506ebf4ef4a4f84e8eebf1ac924ab Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 31 Mar 2016 19:17:58 -0400
Subject: [PATCH] Do not load chunks for Pathfinding
@ -18,7 +18,7 @@ index c76087614..475c93836 100644
}
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 6ce35018a..2a391be28 100644
index 7b27251b3..fe19167a1 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -22,8 +22,9 @@ public abstract class NavigationAbstract {
@ -40,7 +40,7 @@ index 6ce35018a..2a391be28 100644
}
public BlockPosition h() {
@@ -178,6 +180,7 @@ public abstract class NavigationAbstract {
@@ -176,6 +178,7 @@ public abstract class NavigationAbstract {
}
public void c() {

Datei anzeigen

@ -1,4 +1,4 @@
From 35aa24c0126b90f8be8c2ca53096fef70a85f5d0 Mon Sep 17 00:00:00 2001
From 86cfce2ef59058237e194d6be275d49645d503f8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 19 Dec 2016 23:07:42 -0500
Subject: [PATCH] Prevent Pathfinding out of World Border
@ -6,12 +6,12 @@ Subject: [PATCH] Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 2a391be28a..0586597e73 100644
index fe19167a1..6a1d5a899 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -100,6 +100,7 @@ public abstract class NavigationAbstract {
@Nullable
protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
@@ -98,6 +98,7 @@ public abstract class NavigationAbstract {
@Nullable protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) { return this.a(blockposition, null, d0, d1, d2, i, flag); }
@Nullable protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
// Paper end
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
if (!this.a()) {

Datei anzeigen

@ -1,4 +1,4 @@
From b1186b7a08e6001e53378135aee676be3161e346 Mon Sep 17 00:00:00 2001
From 9191de4a11253b499d78e48c4794d62b772d65e4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 9 Sep 2018 13:30:00 -0400
Subject: [PATCH] Mob Pathfinding API
@ -123,7 +123,7 @@ index 000000000..f68a07cb9
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 0586597e7..583f2c5ad 100644
index 6a1d5a899..f6a5aa27b 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -69,7 +69,7 @@ public abstract class NavigationAbstract {
@ -135,7 +135,7 @@ index 0586597e7..583f2c5ad 100644
return this.b(new BlockPosition(d0, d1, d2));
}
@@ -86,7 +86,7 @@ public abstract class NavigationAbstract {
@@ -85,7 +85,7 @@ public abstract class NavigationAbstract {
}
@Nullable
@ -144,7 +144,7 @@ index 0586597e7..583f2c5ad 100644
BlockPosition blockposition = new BlockPosition(entity);
double d0 = entity.locX;
double d1 = entity.getBoundingBox().minY;
@@ -152,6 +152,7 @@ public abstract class NavigationAbstract {
@@ -150,6 +150,7 @@ public abstract class NavigationAbstract {
private int pathfindFailures = 0;
// Paper end
@ -152,7 +152,7 @@ index 0586597e7..583f2c5ad 100644
public boolean a(@Nullable PathEntity pathentity, double d0) {
if (pathentity == null) {
this.c = null;
@@ -175,7 +176,7 @@ public abstract class NavigationAbstract {
@@ -173,7 +174,7 @@ public abstract class NavigationAbstract {
}
}
@ -161,7 +161,7 @@ index 0586597e7..583f2c5ad 100644
public PathEntity l() {
return this.c;
}
@@ -283,6 +284,7 @@ public abstract class NavigationAbstract {
@@ -281,6 +282,7 @@ public abstract class NavigationAbstract {
return this.c == null || this.c.b();
}