summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityWolf.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-11-26 08:32:16 +1100
committermd_5 <git@md-5.net>2014-11-28 17:16:30 +1100
commit24557bc2b37deb6a0edf497d547471832457b1dd (patch)
treec560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/EntityWolf.patch
parenta4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff)
downloadcraftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/EntityWolf.patch')
-rw-r--r--nms-patches/EntityWolf.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch
new file mode 100644
index 00000000..1621a484
--- /dev/null
+++ b/nms-patches/EntityWolf.patch
@@ -0,0 +1,87 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/EntityWolf.java 2014-11-27 08:59:46.749421635 +1100
++++ src/main/java/net/minecraft/server/EntityWolf.java 2014-11-27 08:42:10.160850895 +1100
+@@ -1,5 +1,10 @@
+ package net.minecraft.server;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
++// CraftBukkit end
++
+ public class EntityWolf extends EntityTameableAnimal {
+
+ private float bm;
+@@ -51,8 +56,19 @@
+ } else if (!this.isTamed()) {
+ this.setAngry(true);
+ }
++ }
+
++ // CraftBukkit - add overriden version
++ @Override
++ public void setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
++ super.setGoalTarget(entityliving, reason, fire);
++ if (entityliving == null) {
++ this.setAngry(false);
++ } else if (!this.isTamed()) {
++ this.setAngry(true);
++ }
+ }
++ // CraftBukkit end
+
+ protected void E() {
+ this.datawatcher.watch(18, Float.valueOf(this.getHealth()));
+@@ -85,7 +101,8 @@
+ }
+
+ protected String z() {
+- return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
++ // CraftBukkit - (getFloat(18) < 10) -> (getFloat(18) < this.getMaxHealth() / 2)
++ return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getFloat(18) < this.getMaxHealth() / 2 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
+ }
+
+ protected String bn() {
+@@ -219,7 +236,7 @@
+ --itemstack.count;
+ }
+
+- this.heal((float) itemfood.getNutrition(itemstack));
++ this.heal((float) itemfood.getNutrition(itemstack), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
+ if (itemstack.count <= 0) {
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
+ }
+@@ -244,7 +261,7 @@
+ this.bk.setSitting(!this.isSitting());
+ this.aW = false;
+ this.navigation.n();
+- this.setGoalTarget((EntityLiving) null);
++ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
+ }
+ } else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) {
+ if (!entityhuman.abilities.canInstantlyBuild) {
+@@ -256,12 +273,13 @@
+ }
+
+ if (!this.world.isStatic) {
+- if (this.random.nextInt(3) == 0) {
++ // CraftBukkit - added event call and isCancelled check.
++ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
+ this.setTamed(true);
+ this.navigation.n();
+- this.setGoalTarget((EntityLiving) null);
++ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true);
+ this.bk.setSitting(true);
+- this.setHealth(20.0F);
++ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
+ this.setOwnerUUID(entityhuman.getUniqueID().toString());
+ this.l(true);
+ this.world.broadcastEntityEffect(this, (byte) 7);
+@@ -348,7 +366,7 @@
+ }
+
+ protected boolean isTypeNotPersistent() {
+- return !this.isTamed() && this.ticksLived > 2400;
++ return !this.isTamed() /*&& this.ticksLived > 2400*/; // CraftBukkit
+ }
+
+ public boolean a(EntityLiving entityliving, EntityLiving entityliving1) {