mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-20 09:35:39 +01:00
Review EntityPathfindEvent
Add missing target forward
This commit is contained in:
parent
a2db4c09a2
commit
da850bab55
@ -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>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Mon, 28 Mar 2016 21:22:26 -0400
|
Date: Mon, 28 Mar 2016 21:22:26 -0400
|
||||||
Subject: [PATCH] EntityPathfindEvent
|
Subject: [PATCH] EntityPathfindEvent
|
||||||
|
|
||||||
Fires when an Entity decides to start moving to a location.
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||||
+++ b/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;
|
@@ -4,7 +4,7 @@ import javax.annotation.Nullable;
|
||||||
@ -18,15 +31,15 @@ index 2ced8dedd..6ce35018a 100644
|
|||||||
protected final World b;
|
protected final World b;
|
||||||
@Nullable
|
@Nullable
|
||||||
protected PathEntity c;
|
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));
|
return this.b(new BlockPosition(d0, d1, d2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- @Nullable
|
||||||
|
- public PathEntity b(BlockPosition blockposition) {
|
||||||
+ // Paper start - Add target entity parameter for path find event
|
+ // 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) { return this.b(blockposition, null); }
|
||||||
@Nullable
|
+ @Nullable public PathEntity b(BlockPosition blockposition, Entity target) {
|
||||||
- public PathEntity b(BlockPosition blockposition) {
|
|
||||||
+ public PathEntity b(BlockPosition blockposition, Entity target) {
|
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
float f = (float) blockposition.getX() + 0.5F;
|
float f = (float) blockposition.getX() + 0.5F;
|
||||||
float f1 = (float) blockposition.getY() + 0.5F;
|
float f1 = (float) blockposition.getY() + 0.5F;
|
||||||
@ -37,7 +50,7 @@ index 2ced8dedd..6ce35018a 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -87,16 +90,25 @@ public abstract class NavigationAbstract {
|
@@ -87,16 +89,24 @@ public abstract class NavigationAbstract {
|
||||||
double d1 = entity.getBoundingBox().minY;
|
double d1 = entity.getBoundingBox().minY;
|
||||||
double d2 = entity.locZ;
|
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
|
+ 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
|
+ // 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) { return this.a(blockposition, null, d0, d1, d2, i, flag); }
|
||||||
@Nullable
|
+ @Nullable protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
|
||||||
- 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) {
|
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (!this.a()) {
|
if (!this.a()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -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>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
||||||
Subject: [PATCH] Do not load chunks for Pathfinding
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||||
+++ b/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 {
|
@@ -22,8 +22,9 @@ public abstract class NavigationAbstract {
|
||||||
@ -40,7 +40,7 @@ index 6ce35018a..2a391be28 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockPosition h() {
|
public BlockPosition h() {
|
||||||
@@ -178,6 +180,7 @@ public abstract class NavigationAbstract {
|
@@ -176,6 +178,7 @@ public abstract class NavigationAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void c() {
|
public void c() {
|
||||||
|
@ -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>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Mon, 19 Dec 2016 23:07:42 -0500
|
Date: Mon, 19 Dec 2016 23:07:42 -0500
|
||||||
Subject: [PATCH] Prevent Pathfinding out of World Border
|
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
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||||
+++ b/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 {
|
@@ -98,6 +98,7 @@ public abstract class NavigationAbstract {
|
||||||
@Nullable
|
@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); }
|
||||||
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
|
// Paper end
|
||||||
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
|
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
|
||||||
if (!this.a()) {
|
if (!this.a()) {
|
||||||
|
@ -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>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sun, 9 Sep 2018 13:30:00 -0400
|
Date: Sun, 9 Sep 2018 13:30:00 -0400
|
||||||
Subject: [PATCH] Mob Pathfinding API
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||||
+++ b/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 {
|
@@ -69,7 +69,7 @@ public abstract class NavigationAbstract {
|
||||||
@ -135,7 +135,7 @@ index 0586597e7..583f2c5ad 100644
|
|||||||
return this.b(new BlockPosition(d0, d1, d2));
|
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
|
@Nullable
|
||||||
@ -144,7 +144,7 @@ index 0586597e7..583f2c5ad 100644
|
|||||||
BlockPosition blockposition = new BlockPosition(entity);
|
BlockPosition blockposition = new BlockPosition(entity);
|
||||||
double d0 = entity.locX;
|
double d0 = entity.locX;
|
||||||
double d1 = entity.getBoundingBox().minY;
|
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;
|
private int pathfindFailures = 0;
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ index 0586597e7..583f2c5ad 100644
|
|||||||
public boolean a(@Nullable PathEntity pathentity, double d0) {
|
public boolean a(@Nullable PathEntity pathentity, double d0) {
|
||||||
if (pathentity == null) {
|
if (pathentity == null) {
|
||||||
this.c = 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() {
|
public PathEntity l() {
|
||||||
return this.c;
|
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();
|
return this.c == null || this.c.b();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user