diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch new file mode 100644 index 0000000000..659203726a --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch @@ -0,0 +1,76 @@ +--- a/net/minecraft/world/entity/animal/Wolf.java ++++ b/net/minecraft/world/entity/animal/Wolf.java +@@ -70,6 +70,12 @@ + import net.minecraft.world.phys.Vec3; + import org.joml.Vector3f; + ++// CraftBukkit start ++import org.bukkit.event.entity.EntityRegainHealthEvent; ++import org.bukkit.event.entity.EntityTargetEvent; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++// CraftBukkit end ++ + public class Wolf extends TamableAnimal implements NeutralMob { + + private static final EntityDataAccessor<Boolean> DATA_INTERESTED_ID = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.BOOLEAN); +@@ -313,15 +304,19 @@ + } else { + Entity entity = damagesource.getEntity(); + +- if (!this.level().isClientSide) { +- this.setOrderedToSit(false); +- } ++ // CraftBukkit - move diff down + + if (entity != null && !(entity instanceof Player) && !(entity instanceof AbstractArrow)) { + f = (f + 1.0F) / 2.0F; + } + +- return super.hurt(damagesource, f); ++ // CraftBukkit start ++ boolean result = super.hurt(source, amount); ++ if (!this.level().isClientSide && result) { ++ this.setOrderedToSit(false); ++ } ++ return result; ++ // CraftBukkit end + } + } + +@@ -343,7 +336,7 @@ + super.setTame(flag); + if (flag) { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(20.0D); +- this.setHealth(20.0F); ++ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth() + } else { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0D); + } +@@ -367,7 +359,7 @@ + itemstack.shrink(1); + } + +- this.heal((float) item.getFoodProperties().getNutrition()); ++ this.heal((float) item.getFoodProperties().getNutrition(), EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit + return InteractionResult.SUCCESS; + } else { + if (item instanceof DyeItem) { +@@ -395,7 +387,7 @@ + this.setOrderedToSit(!this.isOrderedToSit()); + this.jumping = false; + this.navigation.stop(); +- this.setTarget((LivingEntity) null); ++ this.setTarget((LivingEntity) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason + return InteractionResult.SUCCESS; + } else { + return interactionresult; +@@ -406,7 +398,8 @@ + 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, player).isCancelled()) { + this.tame(player); + this.navigation.stop(); + this.setTarget((LivingEntity) null); |