0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 15:56:18 +00:00
craftbukkit/nms-patches/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.patch
2023-09-22 02:40:00 +10:00

24 lines
1.0 KiB
Diff

--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
@@ -7,6 +7,11 @@
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class PathfinderGoalTame extends PathfinderGoal {
private final EntityHorseAbstract horse;
@@ -63,7 +68,7 @@
int i = this.horse.getTemper();
int j = this.horse.getMaxTemper();
- if (j > 0 && this.horse.getRandom().nextInt(j) < i) {
+ if (j > 0 && this.horse.getRandom().nextInt(j) < i && !CraftEventFactory.callEntityTameEvent(this.horse, ((CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) { // CraftBukkit - fire EntityTameEvent
this.horse.tameWithName(entityhuman);
return;
}