PaperMC/Spigot-Server-Patches/0097-EntityPathfindEvent.patch

40 lines
1.8 KiB
Diff
Raw Normal View History

2016-12-20 23:34:27 +01:00
From 3dc7b052ab904452c72af7ec8494566f09c289dc 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/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
2016-11-17 03:23:38 +01:00
index 43b2be5..c0ef240 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
2016-06-09 05:57:14 +02:00
@@ -4,7 +4,7 @@ import javax.annotation.Nullable;
public abstract class NavigationAbstract {
- protected EntityInsentient a;
2016-06-09 05:57:14 +02:00
+ protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
protected World b;
2016-05-12 04:07:46 +02:00
@Nullable
protected PathEntity c;
2016-06-09 05:57:14 +02:00
@@ -74,6 +74,7 @@ public abstract class NavigationAbstract {
} 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
2016-06-09 05:57:14 +02:00
this.q = blockposition;
float f = this.h();
2016-06-09 05:57:14 +02:00
@@ -98,6 +99,7 @@ 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
2016-06-09 05:57:14 +02:00
this.q = blockposition;
float f = this.h();
--
2016-12-11 00:50:31 +01:00
2.9.3