Fix death message for tamed animals not having proper cause of death. (#8196)

This commit is contained in:
Take Weiland authored and GitHub committed 2021-11-23 17:11:03 -08:00
1 parent a4e574fa6b
commit 5f87bde00e
1 file changed
+4 -2
@@ -1,15 +1,17 @@
--- a/net/minecraft/world/entity/TamableAnimal.java
+++ b/net/minecraft/world/entity/TamableAnimal.java
@@ -197,11 +_,14 @@
@@ -197,11 +_,15 @@
}
public void m_6667_(DamageSource p_21809_) {
+ // FORGE: Super moved to top so that death message would be cancelled properly
+ net.minecraft.network.chat.Component deathMessage = this.m_21231_().m_19293_();
+ super.m_6667_(p_21809_);
+
+ if (this.f_20890_)
if (!this.f_19853_.f_46443_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_) && this.m_142480_() instanceof ServerPlayer) {
this.m_142480_().m_6352_(this.m_21231_().m_19293_(), Util.f_137441_);
- this.m_142480_().m_6352_(this.m_21231_().m_19293_(), Util.f_137441_);
+ this.m_142480_().m_6352_(deathMessage, Util.f_137441_);
}
- super.m_6667_(p_21809_);