2016-07-01 03:40:42 +02:00
|
|
|
--- a/net/minecraft/server/PathfinderGoalTempt.java
|
|
|
|
+++ b/net/minecraft/server/PathfinderGoalTempt.java
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -1,6 +1,12 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
package net.minecraft.server;
|
2016-11-17 02:41:03 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
import java.util.EnumSet;
|
2016-07-01 03:40:42 +02:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.EntityTargetEvent;
|
|
|
|
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
|
|
|
+// CraftBukkit end
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2016-07-01 03:40:42 +02:00
|
|
|
public class PathfinderGoalTempt extends PathfinderGoal {
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -12,7 +18,7 @@
|
2016-07-01 03:40:42 +02:00
|
|
|
private double g;
|
2019-04-23 04:00:00 +02:00
|
|
|
private double h;
|
|
|
|
private double i;
|
|
|
|
- protected EntityHuman target;
|
|
|
|
+ protected EntityLiving target; // CraftBukkit
|
|
|
|
private int j;
|
|
|
|
private boolean k;
|
|
|
|
private final RecipeItemStack l;
|
|
|
|
@@ -40,7 +46,17 @@
|
2016-07-01 03:40:42 +02:00
|
|
|
return false;
|
|
|
|
} else {
|
2019-04-23 04:00:00 +02:00
|
|
|
this.target = this.a.world.a(PathfinderGoalTempt.c, (EntityLiving) this.a);
|
2017-05-14 04:00:00 +02:00
|
|
|
- return this.target == null ? false : this.a(this.target.getItemInMainHand()) || this.a(this.target.getItemInOffHand());
|
2016-07-01 03:40:42 +02:00
|
|
|
+ // CraftBukkit start
|
2017-05-14 04:00:00 +02:00
|
|
|
+ boolean tempt = this.target == null ? false : this.a(this.target.getItemInMainHand()) || this.a(this.target.getItemInOffHand());
|
2016-07-01 03:40:42 +02:00
|
|
|
+ if (tempt) {
|
2017-05-14 04:00:00 +02:00
|
|
|
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.a, this.target, EntityTargetEvent.TargetReason.TEMPT);
|
2016-07-01 03:40:42 +02:00
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
2017-06-03 07:44:10 +02:00
|
|
|
+ this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle();
|
2016-07-01 03:40:42 +02:00
|
|
|
+ }
|
|
|
|
+ return tempt;
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|