fix: correctly determine when to send death message instead of knockdown message
This commit is contained in:
parent
3b499b9f5c
commit
4e02f61903
2 changed files with 6 additions and 4 deletions
|
@ -70,10 +70,12 @@ public class KnockdownsEvents {
|
|||
KnockdownsNetwork.sendToWorld(player.getServerWorld(), new PlayKnockedDownSoundS2CPacket(player.getX(), player.getY(), player.getZ()));
|
||||
|
||||
Text deathMessage = entity.getDamageTracker().getDeathMessage();
|
||||
TranslatableTextContent content = (TranslatableTextContent) deathMessage.getContent();
|
||||
Text replaced = Text.translatableWithFallback(content.getKey().replace("death.", "knockdown."), deathMessage.getString(), content.getArgs());
|
||||
TranslatableTextContent deathContent = (TranslatableTextContent) deathMessage.getContent();
|
||||
|
||||
server.getPlayerManager().broadcast(replaced, false);
|
||||
String knockdownKey = deathContent.getKey().replace("death.", "knockdown.");
|
||||
Text knockdownMessage = Text.translatable(knockdownKey, deathContent.getArgs());
|
||||
|
||||
server.getPlayerManager().broadcast(!knockdownMessage.getString().equals(knockdownKey) ? knockdownMessage : deathMessage, false);
|
||||
|
||||
return EventResult.interruptFalse();
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ minecraft_version=1.20.1
|
|||
enabled_platforms=fabric,forge
|
||||
|
||||
archives_base_name=knockdowns
|
||||
mod_version=2.1.0
|
||||
mod_version=2.1.1
|
||||
maven_group=ru.octol1ttle.knockdowns
|
||||
|
||||
architectury_version=9.1.12
|
||||
|
|
Loading…
Reference in a new issue