mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:39:58 +03:00
83 lines
3.3 KiB
Diff
83 lines
3.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityWolf.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityWolf.java
|
|
@@ -3,6 +3,10 @@
|
|
import com.google.common.base.Predicate;
|
|
import java.util.UUID;
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
+
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.EntityAgeable;
|
|
@@ -96,6 +100,22 @@
|
|
this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, false));
|
|
}
|
|
|
|
+ // CraftBukkit - add overriden version
|
|
+ @Override
|
|
+ public boolean setGoalTarget(@Nullable EntityLivingBase entityliving, TargetReason reason, boolean fire) {
|
|
+ if (!super.setGoalTarget(entityliving, reason, fire)) {
|
|
+ return false;
|
|
+ }
|
|
+ entityliving = getAttackTarget();
|
|
+ if (entityliving == null) {
|
|
+ this.setAngry(false);
|
|
+ } else if (!this.isTamed()) {
|
|
+ this.setAngry(true);
|
|
+ }
|
|
+ return true;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
protected void applyEntityAttributes()
|
|
{
|
|
super.applyEntityAttributes();
|
|
@@ -323,7 +343,9 @@
|
|
|
|
if (this.aiSit != null)
|
|
{
|
|
- this.aiSit.setSitting(false);
|
|
+ // CraftBukkit - moved into EntityLivingBase.attackEntityFrom(source, amount)
|
|
+ // PAIL : checkme
|
|
+ // this.aiSit.setSitting(false);
|
|
}
|
|
|
|
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
|
@@ -380,7 +402,7 @@
|
|
--stack.stackSize;
|
|
}
|
|
|
|
- this.heal((float)itemfood.getHealAmount(stack));
|
|
+ this.heal((float)itemfood.getHealAmount(stack), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
|
return true;
|
|
}
|
|
}
|
|
@@ -407,7 +429,7 @@
|
|
this.aiSit.setSitting(!this.isSitting());
|
|
this.isJumping = false;
|
|
this.navigator.clearPathEntity();
|
|
- this.setAttackTarget((EntityLivingBase)null);
|
|
+ this.setGoalTarget((EntityLivingBase)null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
|
}
|
|
}
|
|
else if (stack != null && stack.getItem() == Items.BONE && !this.isAngry())
|
|
@@ -419,13 +441,14 @@
|
|
|
|
if (!this.worldObj.isRemote)
|
|
{
|
|
- if (this.rand.nextInt(3) == 0)
|
|
+ // CraftBukkit - added event call and isCancelled check.
|
|
+ if (this.rand.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, player).isCancelled())
|
|
{
|
|
this.setTamed(true);
|
|
this.navigator.clearPathEntity();
|
|
this.setAttackTarget((EntityLivingBase)null);
|
|
this.aiSit.setSitting(true);
|
|
- this.setHealth(20.0F);
|
|
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
|
|
this.setOwnerId(player.getUniqueID());
|
|
this.playTameEffect(true);
|
|
this.worldObj.setEntityState(this, (byte)7);
|