1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-27 08:50:35 +01:00

SPIGOT-7815: Consider EntityDamageEvent status for Wolf armor damage

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2024-07-06 08:33:12 +10:00
parent 76326aa5f8
commit f59f0d1c9b

View file

@ -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) {