2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntityWolf.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -69,6 +69,11 @@
|
|
|
|
import net.minecraft.world.level.pathfinder.PathType;
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -126,6 +131,24 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
return EntityInsentient.createMobAttributes().add(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).add(GenericAttributes.MAX_HEALTH, 8.0D).add(GenericAttributes.ATTACK_DAMAGE, 2.0D);
|
2015-02-26 23:41:06 +01:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+ // CraftBukkit - add overriden version
|
|
|
|
+ @Override
|
2021-11-21 23:00:00 +01:00
|
|
|
+ public boolean setTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
|
|
|
+ if (!super.setTarget(entityliving, reason, fire)) {
|
2016-04-20 12:40:16 +02:00
|
|
|
+ return false;
|
|
|
|
+ }
|
2021-11-21 23:00:00 +01:00
|
|
|
+ entityliving = getTarget();
|
2020-06-25 02:00:00 +02:00
|
|
|
+ /* // PAIL
|
2014-11-25 22:32:16 +01:00
|
|
|
+ if (entityliving == null) {
|
|
|
|
+ this.setAngry(false);
|
|
|
|
+ } else if (!this.isTamed()) {
|
|
|
|
+ this.setAngry(true);
|
|
|
|
+ }
|
2020-06-25 02:00:00 +02:00
|
|
|
+ */
|
2016-04-20 12:40:16 +02:00
|
|
|
+ return true;
|
2015-02-26 23:41:06 +01:00
|
|
|
+ }
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
protected void defineSynchedData() {
|
|
|
|
super.defineSynchedData();
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -298,7 +321,7 @@
|
2014-12-09 15:40:38 +01:00
|
|
|
Entity entity = damagesource.getEntity();
|
|
|
|
|
2022-02-28 16:00:00 +01:00
|
|
|
if (!this.level.isClientSide) {
|
|
|
|
- this.setOrderedToSit(false);
|
|
|
|
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
2020-06-25 02:00:00 +02:00
|
|
|
}
|
2022-02-28 16:00:00 +01:00
|
|
|
|
|
|
|
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
|
|
|
@@ -325,7 +348,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
super.setTame(flag);
|
2019-12-10 23:00:00 +01:00
|
|
|
if (flag) {
|
2021-11-21 23:00:00 +01:00
|
|
|
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
|
2019-12-10 23:00:00 +01:00
|
|
|
- this.setHealth(20.0F);
|
|
|
|
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
|
|
|
|
} else {
|
2021-11-21 23:00:00 +01:00
|
|
|
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
2019-12-10 23:00:00 +01:00
|
|
|
}
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -349,7 +372,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
itemstack.shrink(1);
|
2016-02-29 22:32:46 +01:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- this.heal((float) item.getFoodProperties().getNutrition());
|
|
|
|
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
2020-06-25 02:00:00 +02:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
2019-12-10 23:00:00 +01:00
|
|
|
}
|
2022-06-07 18:00:00 +02:00
|
|
|
|
|
|
|
@@ -360,7 +383,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
this.setOrderedToSit(!this.isOrderedToSit());
|
2020-06-25 02:00:00 +02:00
|
|
|
this.jumping = false;
|
2021-11-21 23:00:00 +01:00
|
|
|
this.navigation.stop();
|
|
|
|
- this.setTarget((EntityLiving) null);
|
|
|
|
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
2020-06-25 02:00:00 +02:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
|
|
|
}
|
|
|
|
|
2022-06-07 18:00:00 +02:00
|
|
|
@@ -382,7 +405,8 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
itemstack.shrink(1);
|
2019-12-10 23:00:00 +01:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
- if (this.random.nextInt(3) == 0) {
|
|
|
|
+ // CraftBukkit - added event call and isCancelled check.
|
|
|
|
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
2019-04-23 04:00:00 +02:00
|
|
|
this.tame(entityhuman);
|
2021-11-21 23:00:00 +01:00
|
|
|
this.navigation.stop();
|
|
|
|
this.setTarget((EntityLiving) null);
|