2022-03-20 00:50:33 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
|
|
Date: Mon, 21 Jun 2021 21:24:45 -0400
|
|
|
|
Subject: [PATCH] Add TameableDeathMessageEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
2022-06-08 13:36:56 +00:00
|
|
|
index 59878c68d9e25a6f4ece26566d8e2b5108536ae8..acc25fb309568864dd7b53ad6a7a3ee6ff18e82a 100644
|
2022-03-20 00:50:33 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
2022-06-08 13:36:56 +00:00
|
|
|
@@ -208,7 +208,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
2022-03-20 00:50:33 +00:00
|
|
|
@Override
|
2022-06-08 13:36:56 +00:00
|
|
|
public void die(DamageSource damageSource) {
|
2022-03-20 00:50:33 +00:00
|
|
|
if (!this.level.isClientSide && this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) {
|
2022-06-08 13:36:56 +00:00
|
|
|
- this.getOwner().sendSystemMessage(this.getCombatTracker().getDeathMessage());
|
2022-03-20 00:50:33 +00:00
|
|
|
+ // Paper start - TameableDeathMessageEvent
|
|
|
|
+ io.papermc.paper.event.entity.TameableDeathMessageEvent event = new io.papermc.paper.event.entity.TameableDeathMessageEvent((org.bukkit.entity.Tameable) getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getCombatTracker().getDeathMessage()));
|
|
|
|
+ if (event.callEvent()) {
|
2022-06-08 13:36:56 +00:00
|
|
|
+ this.getOwner().sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.deathMessage()));
|
|
|
|
+ }
|
|
|
|
+ // Paper end - TameableDeathMessageEvent
|
2022-03-20 00:50:33 +00:00
|
|
|
}
|
|
|
|
|
2022-06-08 13:36:56 +00:00
|
|
|
super.die(damageSource);
|