More 1.14 updates (#1995)
This commit is contained in:
@@ -6,32 +6,76 @@ Subject: [PATCH] EntityPathfindEvent
|
||||
Fires when an Entity decides to start moving to a location.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 60b5068e32..604049b088 100644
|
||||
index 2ced8dedd..6ce35018a 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
public abstract class NavigationAbstract {
|
||||
|
||||
- protected EntityInsentient a;
|
||||
+ protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
||||
protected World b;
|
||||
- protected final EntityInsentient a;
|
||||
+ protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
||||
protected final World b;
|
||||
@Nullable
|
||||
protected PathEntity c;
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
return this.b(new BlockPosition(d0, d1, d2));
|
||||
}
|
||||
|
||||
+ // 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) {
|
||||
+ // Paper end
|
||||
float f = (float) blockposition.getX() + 0.5F;
|
||||
float f1 = (float) blockposition.getY() + 0.5F;
|
||||
float f2 = (float) blockposition.getZ() + 0.5F;
|
||||
|
||||
- return this.a(blockposition, (double) f, (double) f1, (double) f2, 8, false);
|
||||
+ return this.a(blockposition, target, (double) f, (double) f1, (double) f2, 8, false); // Paper - Path find event
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
double d1 = entity.getBoundingBox().minY;
|
||||
double d2 = entity.locZ;
|
||||
|
||||
- return this.a(blockposition, d0, d1, d2, 16, true);
|
||||
+ return this.a(blockposition, entity, d0, d1, d2, 16, true); // Paper - 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) {
|
||||
+ protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
|
||||
+ // Paper end
|
||||
if (!this.a()) {
|
||||
return null;
|
||||
} else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
|
||||
return this.c;
|
||||
} else {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(getEntity().world, blockposition), null).callEvent()) { return null; } // Paper
|
||||
+ // Paper start - Pathfind event
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
|
||||
+ MCUtil.toLocation(getEntity().world, blockposition), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.q = blockposition;
|
||||
float f = this.j();
|
||||
float f = this.i();
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
|
||||
return this.c;
|
||||
} else {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(entity.world, blockposition), entity.getBukkitEntity()).callEvent()) { return null; } // Paper
|
||||
this.q = blockposition;
|
||||
float f = this.j();
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
index 9dfca6067..551ff417b 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
@@ -0,0 +0,0 @@ public class NavigationFlying extends NavigationAbstract {
|
||||
|
||||
@Override
|
||||
public PathEntity a(Entity entity) {
|
||||
- return this.b(new BlockPosition(entity));
|
||||
+ return this.b(new BlockPosition(entity), entity); // Paper - Pathfind event
|
||||
}
|
||||
|
||||
@Override
|
||||
--
|
||||
Reference in New Issue
Block a user