mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:39:58 +03:00
32 lines
2.2 KiB
Diff
32 lines
2.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java
|
|
@@ -13,6 +13,9 @@
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
+import org.bukkit.event.entity.EntityTeleportEvent;
|
|
|
|
public class EntityAIFollowOwner extends EntityAIBase
|
|
{
|
|
@@ -114,7 +117,17 @@
|
|
{
|
|
if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.isTeleportFriendlyBlock(i, j, k, l, i1))
|
|
{
|
|
- this.tameable.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.tameable.rotationYaw, this.tameable.rotationPitch);
|
|
+ // this.tameable.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.tameable.rotationYaw, this.tameable.rotationPitch);
|
|
+ CraftEntity entity = this.tameable.getBukkitEntity();
|
|
+ Location to = new Location(entity.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.tameable.rotationYaw, this.tameable.rotationPitch);
|
|
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
|
|
+ this.tameable.world.getServer().getPluginManager().callEvent(event);
|
|
+ if (event.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ to = event.getTo();
|
|
+
|
|
+ this.tameable.setLocationAndAngles(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
|
this.petPathfinder.clearPath();
|
|
return;
|
|
}
|