diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch new file mode 100644 index 0000000000..797e233cff --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Wolf.java.patch @@ -0,0 +1,75 @@ +--- 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); + private static final EntityDataAccessor<Integer> DATA_COLLAR_COLOR = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.INT); +@@ -310,11 +304,19 @@ + this.setOrderedToSit(false); + } + ++ // CraftBukkit - move diff down ++ + if (entity != null && !(entity instanceof Player) && !(entity instanceof AbstractArrow)) { + amount = (amount + 1.0F) / 2.0F; + } + +- return super.hurt(source, amount); ++ // CraftBukkit start ++ boolean result = super.hurt(source, amount); ++ if (!this.level().isClientSide && result) { ++ this.setOrderedToSit(false); ++ } ++ return result; ++ // CraftBukkit end + } + } + +@@ -332,8 +335,8 @@ + public void setTame(boolean tamed) { + super.setTame(tamed); + if (tamed) { +- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(20.0); +- this.setHealth(20.0F); ++ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(20.0D); ++ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth() + } else { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0); + } +@@ -354,7 +359,7 @@ + itemInHand.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 dyeItem && this.isOwnedBy(player)) { +@@ -376,7 +387,7 @@ + this.setOrderedToSit(!this.isOrderedToSit()); + this.jumping = false; + this.navigation.stop(); +- this.setTarget(null); ++ this.setTarget((LivingEntity) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason + return InteractionResult.SUCCESS; + } else { + return interactionResult; +@@ -387,7 +398,8 @@ + itemInHand.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(null); |