diff options
author | FearThe1337 <admin@fearthe1337.com> | 2014-12-09 15:40:38 +0100 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-10 18:35:55 +0000 |
commit | e24569a9ed3e65942c0de667d2f4b66fc9dcec82 (patch) | |
tree | 88e0baeb4dbd5980ff5921ff680af1883f9f5bb5 | |
parent | 0af8ea10d80db5e6ed1e49fdb432a820ac4681e6 (diff) | |
download | craftbukkit-e24569a9ed3e65942c0de667d2f4b66fc9dcec82.tar craftbukkit-e24569a9ed3e65942c0de667d2f4b66fc9dcec82.tar.gz craftbukkit-e24569a9ed3e65942c0de667d2f4b66fc9dcec82.tar.lz craftbukkit-e24569a9ed3e65942c0de667d2f4b66fc9dcec82.tar.xz craftbukkit-e24569a9ed3e65942c0de667d2f4b66fc9dcec82.zip |
SPIGOT-143: Fix various animal stuff not being canceled by damageEntity.
Fixes wolves and ocelots standing up when the damag event is being canceled.
Also stops breeding mode reset by the same event.
-rw-r--r-- | nms-patches/EntityAnimal.patch | 23 | ||||
-rw-r--r-- | nms-patches/EntityLiving.patch | 32 | ||||
-rw-r--r-- | nms-patches/EntityOcelot.patch | 31 | ||||
-rw-r--r-- | nms-patches/EntityWolf.patch | 22 |
4 files changed, 88 insertions, 20 deletions
diff --git a/nms-patches/EntityAnimal.patch b/nms-patches/EntityAnimal.patch new file mode 100644 index 00000000..4b90e467 --- /dev/null +++ b/nms-patches/EntityAnimal.patch @@ -0,0 +1,23 @@ +--- ../work/decompile-8eb82bde/net/minecraft/server/EntityAnimal.java 2014-12-10 18:34:37.064492562 +0000 ++++ src/main/java/net/minecraft/server/EntityAnimal.java 2014-12-10 18:31:55.772494313 +0000 +@@ -38,14 +38,19 @@ + + } + ++ /* CraftBukkit start ++ // Function disabled as it has no special function anymore after ++ // setSitting is disabled. + public boolean damageEntity(DamageSource damagesource, float f) { + if (this.isInvulnerable(damagesource)) { + return false; + } else { +- this.bk = 0; ++ //CraftBukkit - moved into EntityLiving.d(DamageSource, float) ++ //this.bk = 0; + return super.damageEntity(damagesource, f); + } + } ++ // CraftBukkit end */ + + public float a(BlockPosition blockposition) { + return this.world.getType(blockposition.down()).getBlock() == Blocks.GRASS ? 10.0F : this.world.o(blockposition) - 0.5F; diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index e28fdd6e..f6652912 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityLiving.java 2014-11-28 17:43:43.129707434 +0000 -+++ src/main/java/net/minecraft/server/EntityLiving.java 2014-11-28 17:38:22.000000000 +0000 +--- ../work/decompile-8eb82bde/net/minecraft/server/EntityLiving.java 2014-12-10 18:34:37.200492561 +0000 ++++ src/main/java/net/minecraft/server/EntityLiving.java 2014-12-10 18:32:58.472493632 +0000 @@ -8,6 +8,15 @@ import java.util.Random; import java.util.UUID; @@ -208,7 +208,7 @@ this.getEquipment(4).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this); f *= 0.75F; } -@@ -602,13 +683,22 @@ +@@ -602,16 +683,34 @@ return false; } @@ -233,7 +233,19 @@ this.hurtTicks = this.at = 10; } -@@ -717,11 +807,19 @@ ++ // CraftBukkit start ++ if(this instanceof EntityAnimal){ ++ ((EntityAnimal)this).cq(); ++ if(this instanceof EntityTameableAnimal){ ++ ((EntityTameableAnimal)this).getGoalSit().setSitting(false); ++ } ++ } ++ // CraftBukkit end ++ + this.au = 0.0F; + Entity entity = damagesource.getEntity(); + +@@ -717,11 +816,19 @@ } if (this.aZ() && this.world.getGameRules().getBoolean("doMobLoot")) { @@ -254,7 +266,7 @@ } } -@@ -781,8 +879,13 @@ +@@ -781,8 +888,13 @@ int i = MathHelper.f((f - 3.0F - f2) * f1); if (i > 0) { @@ -269,7 +281,7 @@ int j = MathHelper.floor(this.locX); int k = MathHelper.floor(this.locY - 0.20000000298023224D); int l = MathHelper.floor(this.locZ); -@@ -826,7 +929,7 @@ +@@ -826,7 +938,7 @@ int i = 25 - this.bq(); float f1 = f * (float) i; @@ -278,7 +290,7 @@ f = f1 / 25.0F; } -@@ -840,8 +943,9 @@ +@@ -840,8 +952,9 @@ int i; int j; float f1; @@ -290,7 +302,7 @@ i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; j = 25 - i; f1 = f * (float) j; -@@ -867,22 +971,117 @@ +@@ -867,22 +980,117 @@ } } @@ -414,7 +426,7 @@ } public CombatTracker br() { -@@ -1236,7 +1435,8 @@ +@@ -1236,7 +1444,8 @@ if (f > 0.0025000002F) { f3 = 1.0F; f2 = (float) Math.sqrt((double) f) * 3.0F; @@ -424,7 +436,7 @@ } if (this.ax > 0.0F) { -@@ -1400,6 +1600,13 @@ +@@ -1400,6 +1609,13 @@ if (list != null && !list.isEmpty()) { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); diff --git a/nms-patches/EntityOcelot.patch b/nms-patches/EntityOcelot.patch index 85153b7d..0ec9bbaa 100644 --- a/nms-patches/EntityOcelot.patch +++ b/nms-patches/EntityOcelot.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityOcelot.java 2014-11-28 17:43:43.141707434 +0000 -+++ src/main/java/net/minecraft/server/EntityOcelot.java 2014-11-28 17:38:21.000000000 +0000 +--- ../work/decompile-8eb82bde/net/minecraft/server/EntityOcelot.java 2014-12-10 18:34:37.228492560 +0000 ++++ src/main/java/net/minecraft/server/EntityOcelot.java 2014-12-10 18:33:29.824493292 +0000 @@ -51,7 +51,7 @@ } @@ -9,7 +9,30 @@ } protected void aW() { -@@ -124,7 +124,8 @@ +@@ -95,15 +95,20 @@ + public boolean r(Entity entity) { + return entity.damageEntity(DamageSource.mobAttack(this), 3.0F); + } +- ++ ++ /* CraftBukkit start ++ // Function disabled as it has no special function anymore after ++ // setSitting is disabled. + public boolean damageEntity(DamageSource damagesource, float f) { + if (this.isInvulnerable(damagesource)) { + return false; + } else { +- this.bk.setSitting(false); ++ // CraftBukkit - moved into EntityLiving.d(DamageSource, float) ++ // this.bk.setSitting(false); + return super.damageEntity(damagesource, f); + } + } ++ // CraftBukkit end */ + + protected void dropDeathLoot(boolean flag, int i) {} + +@@ -124,7 +129,8 @@ } if (!this.world.isStatic) { @@ -19,7 +42,7 @@ this.setTamed(true); this.setCatType(1 + this.world.random.nextInt(3)); this.setOwnerUUID(entityhuman.getUniqueID().toString()); -@@ -231,7 +232,7 @@ +@@ -231,7 +237,7 @@ entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entityocelot.setAgeRaw(-24000); diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch index 45263612..71e05777 100644 --- a/nms-patches/EntityWolf.patch +++ b/nms-patches/EntityWolf.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityWolf.java 2014-11-28 17:43:43.181707433 +0000 -+++ src/main/java/net/minecraft/server/EntityWolf.java 2014-11-28 17:38:19.000000000 +0000 +--- ../work/decompile-8eb82bde/net/minecraft/server/EntityWolf.java 2014-12-10 18:34:37.316492559 +0000 ++++ src/main/java/net/minecraft/server/EntityWolf.java 2014-12-10 18:34:29.104492649 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -41,7 +41,17 @@ } protected String bn() { -@@ -219,7 +236,7 @@ +@@ -176,7 +193,8 @@ + } else { + Entity entity = damagesource.getEntity(); + +- this.bk.setSitting(false); ++ // CraftBukkit - moved into EntityLiving.d(DamageSource, float) ++ // this.bk.setSitting(false); + if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { + f = (f + 1.0F) / 2.0F; + } +@@ -219,7 +237,7 @@ --itemstack.count; } @@ -50,7 +60,7 @@ if (itemstack.count <= 0) { entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); } -@@ -244,7 +261,7 @@ +@@ -244,7 +262,7 @@ this.bk.setSitting(!this.isSitting()); this.aW = false; this.navigation.n(); @@ -59,7 +69,7 @@ } } else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) { if (!entityhuman.abilities.canInstantlyBuild) { -@@ -256,12 +273,13 @@ +@@ -256,12 +274,13 @@ } if (!this.world.isStatic) { @@ -76,7 +86,7 @@ this.setOwnerUUID(entityhuman.getUniqueID().toString()); this.l(true); this.world.broadcastEntityEffect(this, (byte) 7); -@@ -348,7 +366,7 @@ +@@ -348,7 +367,7 @@ } protected boolean isTypeNotPersistent() { |