Skip to content

Commit

Permalink
SPIGOT-7815: Consider EntityDamageEvent status for Wolf armor damage
Browse files Browse the repository at this point in the history
  • Loading branch information
Doc94 authored and md-5 committed Jul 5, 2024
1 parent c3ceeb6 commit 66e78a9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions nms-patches/net/minecraft/world/entity/animal/EntityWolf.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
}

@@ -374,9 +384,9 @@
@@ -374,10 +384,15 @@
}

@Override
Expand All @@ -41,17 +41,23 @@
- 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 @@
}

}
+ return false; // CraftBukkit
}

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);
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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) {
Expand Down

0 comments on commit 66e78a9

Please sign in to comment.