You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.9 KiB
74 lines
2.9 KiB
--- ../src-base/minecraft/net/minecraft/entity/EntityLeashKnot.java |
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityLeashKnot.java |
|
@@ -11,6 +11,12 @@ |
|
import net.minecraft.util.AxisAlignedBB; |
|
import net.minecraft.world.World; |
|
|
|
+ // CraftBukkit start |
|
+import net.minecraft.entity.player.EntityPlayerMP; |
|
+import net.minecraft.network.play.server.S1BPacketEntityAttach; |
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; |
|
+// CraftBukkit end |
|
+ |
|
public class EntityLeashKnot extends EntityHanging |
|
{ |
|
private static final String __OBFID = "CL_00001548"; |
|
@@ -84,6 +90,14 @@ |
|
|
|
if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == p_130002_1_) |
|
{ |
|
+ // CraftBukkit start |
|
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityliving, this, p_130002_1_).isCancelled()) |
|
+ { |
|
+ ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, entityliving, entityliving.getLeashedToEntity())); |
|
+ continue; |
|
+ } |
|
+ |
|
+ // CraftBukkit end |
|
entityliving.setLeashedToEntity(this, true); |
|
flag = true; |
|
} |
|
@@ -93,9 +107,12 @@ |
|
|
|
if (!this.worldObj.isRemote && !flag) |
|
{ |
|
- this.setDead(); |
|
+ // CraftBukkit start - Move below |
|
+ //this.setDead(); |
|
+ boolean die = true; |
|
|
|
- if (p_130002_1_.capabilities.isCreativeMode) |
|
+ // CraftBukkit end |
|
+ if (true || p_130002_1_.capabilities.isCreativeMode) // CraftBukkit - Process for non-creative as well |
|
{ |
|
d0 = 7.0D; |
|
list = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + d0, this.posZ + d0)); |
|
@@ -110,11 +127,27 @@ |
|
|
|
if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == this) |
|
{ |
|
- entityliving.clearLeashed(true, false); |
|
+ // CraftBukkit start |
|
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityliving, p_130002_1_).isCancelled()) |
|
+ { |
|
+ die = false; |
|
+ continue; |
|
+ } |
|
+ |
|
+ entityliving.clearLeashed(true, !p_130002_1_.capabilities.isCreativeMode); // false -> survival mode boolean |
|
+ // CraftBukkit end |
|
} |
|
} |
|
} |
|
} |
|
+ |
|
+ // CraftBukkit start |
|
+ if (die) |
|
+ { |
|
+ this.setDead(); |
|
+ } |
|
+ |
|
+ // CraftBukkit end |
|
} |
|
|
|
return true;
|
|
|