mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
31 lines
2.1 KiB
Diff
31 lines
2.1 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java
|
|
@@ -1,5 +1,9 @@
|
|
package net.minecraft.entity.ai;
|
|
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
+import org.bukkit.event.entity.EntityTeleportEvent;
|
|
+
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
@@ -118,7 +122,16 @@
|
|
{
|
|
if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.theWorld.getBlockState(new BlockPos(i + l, k - 1, j + i1)).isFullyOpaque() && this.isEmptyBlock(new BlockPos(i + l, k, j + i1)) && this.isEmptyBlock(new BlockPos(i + l, k + 1, j + i1)))
|
|
{
|
|
- this.thePet.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch);
|
|
+ CraftEntity entity = this.thePet.getBukkitEntity();
|
|
+ Location to = new Location(entity.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch);
|
|
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
|
|
+ this.thePet.worldObj.getServer().getPluginManager().callEvent(event);
|
|
+ if (event.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ to = event.getTo();
|
|
+
|
|
+ this.thePet.setLocationAndAngles(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
|
this.petPathfinder.clearPathEntity();
|
|
return;
|
|
}
|