summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityLeash.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-03-01 08:32:46 +1100
committermd_5 <git@md-5.net>2016-03-01 09:32:45 +1100
commitaa008dff0f9bedbe88e1fe79831776b0a52eb90a (patch)
treecb520e0f4cc5d683fb9b7fb95de37480a7443dfb /nms-patches/EntityLeash.patch
parente1ebe524a78e27f6a2829ed4574fded3779094e1 (diff)
downloadcraftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar
craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar.gz
craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar.lz
craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar.xz
craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.zip
Update to Minecraft 1.9
Diffstat (limited to 'nms-patches/EntityLeash.patch')
-rw-r--r--nms-patches/EntityLeash.patch90
1 files changed, 44 insertions, 46 deletions
diff --git a/nms-patches/EntityLeash.patch b/nms-patches/EntityLeash.patch
index 0496ad2f..190a9178 100644
--- a/nms-patches/EntityLeash.patch
+++ b/nms-patches/EntityLeash.patch
@@ -1,61 +1,59 @@
--- a/net/minecraft/server/EntityLeash.java
+++ b/net/minecraft/server/EntityLeash.java
-@@ -3,6 +3,8 @@
- import java.util.Iterator;
- import java.util.List;
+@@ -1,5 +1,7 @@
+ package net.minecraft.server;
-+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
++import org.bukkit.craftbukkit.event.CraftEventFactory;
+
- public class EntityLeash extends EntityHanging {
-
- public EntityLeash(World world) {
-@@ -63,6 +65,12 @@
- while (iterator.hasNext()) {
- entityinsentient = (EntityInsentient) iterator.next();
- if (entityinsentient.cc() && entityinsentient.getLeashHolder() == entityhuman) {
-+ // CraftBukkit start
-+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman).isCancelled()) {
-+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, entityinsentient, entityinsentient.getLeashHolder()));
-+ continue;
-+ }
-+ // CraftBukkit end
- entityinsentient.setLeashHolder(this, true);
- flag = true;
- }
-@@ -70,8 +78,11 @@
- }
+ import java.util.Iterator;
+ import java.util.List;
- if (!this.world.isClientSide && !flag) {
-- this.die();
-- if (entityhuman.abilities.canInstantlyBuild) {
-+ // CraftBukkit start - Move below
-+ // this.die();
-+ boolean die = true;
-+ // CraftBukkit end
-+ if (true || entityhuman.abilities.canInstantlyBuild) { // CraftBukkit - Process for non-creative as well
- d0 = 7.0D;
- list = this.world.a(EntityInsentient.class, new AxisAlignedBB(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + d0, this.locZ + d0));
- iterator = list.iterator();
-@@ -79,10 +90,21 @@
+@@ -73,6 +75,12 @@
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
- if (entityinsentient.cc() && entityinsentient.getLeashHolder() == this) {
-- entityinsentient.unleash(true, false);
+ if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == entityhuman) {
+ // CraftBukkit start
-+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman).isCancelled()) {
-+ die = false;
++ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman).isCancelled()) {
++ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(entityinsentient, entityinsentient.getLeashHolder()));
+ continue;
+ }
-+ entityinsentient.unleash(true, !entityhuman.abilities.canInstantlyBuild); // false -> survival mode boolean
+ // CraftBukkit end
+ entityinsentient.setLeashHolder(this, true);
+ flag = true;
+ }
+@@ -80,8 +88,11 @@
+ }
+
+ if (!flag) {
+- this.die();
+- if (entityhuman.abilities.canInstantlyBuild) {
++ // CraftBukkit start - Move below
++ // this.die();
++ boolean die = true;
++ // CraftBukkit end
++ if (true || entityhuman.abilities.canInstantlyBuild) { // CraftBukkit - Process for non-creative as well
+ d0 = 7.0D;
+ list = this.world.a(EntityInsentient.class, new AxisAlignedBB(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + d0, this.locZ + d0));
+ iterator = list.iterator();
+@@ -89,9 +100,20 @@
+ while (iterator.hasNext()) {
+ entityinsentient = (EntityInsentient) iterator.next();
+ if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) {
+- entityinsentient.unleash(true, false);
++ // CraftBukkit start
++ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman).isCancelled()) {
++ die = false;
++ continue;
++ }
++ entityinsentient.unleash(true, !entityhuman.abilities.canInstantlyBuild); // false -> survival mode boolean
++ // CraftBukkit end
+ }
}
++ // CraftBukkit start
++ if (die) {
++ this.die();
++ }
++ // CraftBukkit end
}
}
-+ // CraftBukkit start
-+ if (die) {
-+ this.die();
-+ }
-+ // CraftBukkit end
- }
- return true;