aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0103-EntityPathfindEvent.patch
blob: f79d2557efd623df879cc729ec2f1aa796f101e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 7288ca42285898ba7a54d71ff19d20cb5e60caf0 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
index b1a90c1..5d0b5a4 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;
 
 public abstract class NavigationAbstract {
 
-    protected EntityInsentient a;
+    protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
     protected World b;
     @Nullable
     protected PathEntity c;
@@ -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
             this.q = blockposition;
             float f = this.h();
 
@@ -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
                 this.q = blockposition;
                 float f = this.h();
 
-- 
2.9.3