SPIGOT-7815: Consider EntityDamageEvent status for Wolf armor damage
This commit is contained in:
parent
c3ceeb6f79
commit
66e78a96b6
@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,9 +384,9 @@
|
@@ -374,10 +384,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -41,9 +41,15 @@
|
|||||||
- super.actuallyHurt(damagesource, f);
|
- super.actuallyHurt(damagesource, f);
|
||||||
+ return super.actuallyHurt(damagesource, f, event); // CraftBukkit
|
+ return super.actuallyHurt(damagesource, f, event); // CraftBukkit
|
||||||
} else {
|
} 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();
|
ItemStack itemstack = this.getBodyArmorItem();
|
||||||
int i = itemstack.getDamageValue();
|
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) {
|
private boolean canArmorAbsorb(DamageSource damagesource) {
|
||||||
@@ -405,7 +416,7 @@
|
@@ -405,7 +421,7 @@
|
||||||
protected void applyTamingSideEffects() {
|
protected void applyTamingSideEffects() {
|
||||||
if (this.isTame()) {
|
if (this.isTame()) {
|
||||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
|
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
|
||||||
@ -60,7 +66,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||||
}
|
}
|
||||||
@@ -432,7 +443,7 @@
|
@@ -432,7 +448,7 @@
|
||||||
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
|
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
|
||||||
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
|
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
|
||||||
|
|
||||||
@ -69,7 +75,7 @@
|
|||||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
|
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
} else {
|
} else {
|
||||||
if (item instanceof ItemDye) {
|
if (item instanceof ItemDye) {
|
||||||
@@ -463,7 +474,9 @@
|
@@ -463,7 +479,9 @@
|
||||||
this.playSound(SoundEffects.ARMOR_UNEQUIP_WOLF);
|
this.playSound(SoundEffects.ARMOR_UNEQUIP_WOLF);
|
||||||
itemstack1 = this.getBodyArmorItem();
|
itemstack1 = this.getBodyArmorItem();
|
||||||
this.setBodyArmorItem(ItemStack.EMPTY);
|
this.setBodyArmorItem(ItemStack.EMPTY);
|
||||||
@ -79,7 +85,7 @@
|
|||||||
return EnumInteractionResult.SUCCESS;
|
return EnumInteractionResult.SUCCESS;
|
||||||
} else if (((RecipeItemStack) ((ArmorMaterial) EnumArmorMaterial.ARMADILLO.value()).repairIngredient().get()).test(itemstack) && this.isInSittingPose() && this.hasArmor() && this.isOwnedBy(entityhuman) && this.getBodyArmorItem().isDamaged()) {
|
} else if (((RecipeItemStack) ((ArmorMaterial) EnumArmorMaterial.ARMADILLO.value()).repairIngredient().get()).test(itemstack) && this.isInSittingPose() && this.hasArmor() && this.isOwnedBy(entityhuman) && this.getBodyArmorItem().isDamaged()) {
|
||||||
itemstack.shrink(1);
|
itemstack.shrink(1);
|
||||||
@@ -480,7 +493,7 @@
|
@@ -480,7 +498,7 @@
|
||||||
this.setOrderedToSit(!this.isOrderedToSit());
|
this.setOrderedToSit(!this.isOrderedToSit());
|
||||||
this.jumping = false;
|
this.jumping = false;
|
||||||
this.navigation.stop();
|
this.navigation.stop();
|
||||||
@ -88,7 +94,7 @@
|
|||||||
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
|
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
|
||||||
} else {
|
} else {
|
||||||
return enuminteractionresult;
|
return enuminteractionresult;
|
||||||
@@ -498,7 +511,8 @@
|
@@ -498,7 +516,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryToTame(EntityHuman entityhuman) {
|
private void tryToTame(EntityHuman entityhuman) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user