From f59f0d1c9b6a6b3981511a709a473f6a6ace52c7 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot <noreply+git-craftbukkit@papermc.io> Date: Sat, 6 Jul 2024 08:33:12 +1000 Subject: [PATCH] SPIGOT-7815: Consider EntityDamageEvent status for Wolf armor damage By: Doc <nachito94@msn.com> --- .../world/entity/animal/EntityWolf.patch | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityWolf.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityWolf.patch index cd34390720..62bec7891e 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityWolf.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityWolf.patch @@ -31,7 +31,7 @@ } } -@@ -374,9 +384,9 @@ +@@ -374,10 +384,15 @@ } @Override @@ -41,9 +41,15 @@ - super.actuallyHurt(damagesource, f); + return super.actuallyHurt(damagesource, f, event); // CraftBukkit } else { ++ // CraftBukkit start - SPIGOT-7815: if the damage was cancelled, no need to run the wolf armor behaviour ++ if (event.isCancelled()) { ++ return false; ++ } ++ // CraftBukkit end ItemStack itemstack = this.getBodyArmorItem(); int i = itemstack.getDamageValue(); -@@ -395,6 +405,7 @@ + int j = itemstack.getMaxDamage(); +@@ -395,6 +410,7 @@ } } @@ -51,7 +57,7 @@ } private boolean canArmorAbsorb(DamageSource damagesource) { -@@ -405,7 +416,7 @@ +@@ -405,7 +421,7 @@ protected void applyTamingSideEffects() { if (this.isTame()) { this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D); @@ -60,7 +66,7 @@ } else { this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D); } -@@ -432,7 +443,7 @@ +@@ -432,7 +448,7 @@ FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD); float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F; @@ -69,7 +75,7 @@ return EnumInteractionResult.sidedSuccess(this.level().isClientSide()); } else { if (item instanceof ItemDye) { -@@ -463,7 +474,9 @@ +@@ -463,7 +479,9 @@ this.playSound(SoundEffects.ARMOR_UNEQUIP_WOLF); itemstack1 = this.getBodyArmorItem(); this.setBodyArmorItem(ItemStack.EMPTY); @@ -79,7 +85,7 @@ return EnumInteractionResult.SUCCESS; } else if (((RecipeItemStack) ((ArmorMaterial) EnumArmorMaterial.ARMADILLO.value()).repairIngredient().get()).test(itemstack) && this.isInSittingPose() && this.hasArmor() && this.isOwnedBy(entityhuman) && this.getBodyArmorItem().isDamaged()) { itemstack.shrink(1); -@@ -480,7 +493,7 @@ +@@ -480,7 +498,7 @@ this.setOrderedToSit(!this.isOrderedToSit()); this.jumping = false; this.navigation.stop(); @@ -88,7 +94,7 @@ return EnumInteractionResult.SUCCESS_NO_ITEM_USED; } else { return enuminteractionresult; -@@ -498,7 +511,8 @@ +@@ -498,7 +516,8 @@ } private void tryToTame(EntityHuman entityhuman) {