2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntityWolf.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
|
2023-09-21 18:40:00 +02:00
|
|
|
@@ -70,6 +70,12 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2023-09-21 18:40:00 +02:00
|
|
|
import org.joml.Vector3f;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+// CraftBukkit start
|
2023-06-24 09:15:05 +02:00
|
|
|
+import org.bukkit.event.entity.EntityRegainHealthEvent;
|
|
|
|
+import org.bukkit.event.entity.EntityTargetEvent;
|
2014-11-25 22:32:16 +01:00
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+// 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);
|
2023-09-21 18:40:00 +02:00
|
|
|
@@ -298,15 +304,19 @@
|
2023-06-24 09:15:05 +02:00
|
|
|
} else {
|
2014-12-09 15:40:38 +01:00
|
|
|
Entity entity = damagesource.getEntity();
|
|
|
|
|
2023-06-24 09:15:05 +02:00
|
|
|
- if (!this.level().isClientSide) {
|
2022-02-28 16:00:00 +01:00
|
|
|
- this.setOrderedToSit(false);
|
2023-06-24 09:15:05 +02:00
|
|
|
- }
|
|
|
|
+ // CraftBukkit - move diff down
|
2022-02-28 16:00:00 +01:00
|
|
|
|
|
|
|
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
2023-06-24 09:15:05 +02:00
|
|
|
f = (f + 1.0F) / 2.0F;
|
|
|
|
}
|
|
|
|
|
|
|
|
- return super.hurt(damagesource, f);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ boolean result = super.hurt(damagesource, f);
|
|
|
|
+ if (!this.level().isClientSide && result) {
|
|
|
|
+ this.setOrderedToSit(false);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-21 18:40:00 +02:00
|
|
|
@@ -326,7 +336,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
|
|
|
}
|
2023-09-21 18:40:00 +02:00
|
|
|
@@ -349,7 +359,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
itemstack.shrink(1);
|
2019-12-10 23:00:00 +01:00
|
|
|
}
|
|
|
|
|
2023-06-07 17:30:00 +02:00
|
|
|
- this.heal((float) item.getFoodProperties().getNutrition());
|
2023-06-24 09:15:05 +02:00
|
|
|
+ this.heal((float) item.getFoodProperties().getNutrition(), EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
2023-06-07 17:30:00 +02:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
|
|
|
} else {
|
|
|
|
if (item instanceof ItemDye) {
|
2023-09-21 18:40:00 +02:00
|
|
|
@@ -377,7 +387,7 @@
|
2023-06-07 17:30:00 +02:00
|
|
|
this.setOrderedToSit(!this.isOrderedToSit());
|
|
|
|
this.jumping = false;
|
2021-11-21 23:00:00 +01:00
|
|
|
this.navigation.stop();
|
2023-06-07 17:30:00 +02:00
|
|
|
- this.setTarget((EntityLiving) null);
|
2023-06-24 09:15:05 +02:00
|
|
|
+ this.setTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
2023-06-07 17:30:00 +02:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
|
|
|
} else {
|
|
|
|
return enuminteractionresult;
|
2023-09-21 18:40:00 +02:00
|
|
|
@@ -388,7 +398,8 @@
|
2023-06-07 17:30:00 +02:00
|
|
|
itemstack.shrink(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
- 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.tame(entityhuman);
|
|
|
|
this.navigation.stop();
|
|
|
|
this.setTarget((EntityLiving) null);
|