13
0
geforkt von Mirrors/Paper

SPIGOT-4635: Restore shield damage sound

Dieser Commit ist enthalten in:
md_5 2019-02-25 18:52:09 +11:00
Ursprung 4e4cde4816
Commit acbba8badd

Datei anzeigen

@ -539,7 +539,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1119,28 +1364,167 @@
@@ -1119,28 +1364,168 @@
}
}
@ -615,15 +615,15 @@
+ }
+ };
+ float absorptionModifier = absorption.apply((double) f).floatValue();
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
- float f2 = f1 - f;
+
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
+ if (event.isCancelled()) {
+ return false;
+ }
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
- float f2 = f1 - f;
+ f = (float) event.getFinalDamage();
+
+ // Resistance
@ -637,7 +637,7 @@
+ }
+ }
+ }
+
+ // Apply damage to helmet
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(EnumItemSlot.HEAD) != null) {
+ this.getEquipment(EnumItemSlot.HEAD).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this);
@ -651,6 +651,7 @@
+
+ // Apply blocking code // PAIL: steal from above
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
+ this.world.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
+ this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING));
+ Entity entity = damagesource.j();
+
@ -717,7 +718,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1207,6 +1591,7 @@
@@ -1207,6 +1592,7 @@
public AttributeMapBase getAttributeMap() {
if (this.attributeMap == null) {
this.attributeMap = new AttributeMapServer();
@ -725,7 +726,7 @@
}
return this.attributeMap;
@@ -1509,6 +1894,7 @@
@@ -1509,6 +1895,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@ -733,7 +734,7 @@
this.setFlag(7, false);
}
} else {
@@ -1907,6 +2293,7 @@
@@ -1907,6 +2294,7 @@
}
if (!this.world.isClientSide) {
@ -741,7 +742,7 @@
this.setFlag(7, flag);
}
@@ -2034,11 +2421,11 @@
@@ -2034,11 +2422,11 @@
}
public boolean isInteractable() {
@ -755,7 +756,7 @@
}
protected void aA() {
@@ -2198,7 +2585,27 @@
@@ -2198,7 +2586,27 @@
protected void q() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.b(this.activeItem, 16);
@ -784,7 +785,7 @@
this.da();
}
@@ -2277,10 +2684,18 @@
@@ -2277,10 +2685,18 @@
}
if (flag1) {