Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
ccb3655c
Commit
ccb3655c
authored
May 24, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Death messages skip tamed creatures and players, to prevent duplicate death messages
parent
5a46f890
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
CHANGELOG.md
CHANGELOG.md
+1
-1
MixinLivingEntity.java
src/main/java/com/owlmaddie/mixin/MixinLivingEntity.java
+10
-0
No files found.
CHANGELOG.md
View file @
ccb3655c
...
...
@@ -8,7 +8,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
### Added
-
New automated deployments for Modrinth and CurseForge (GitLab CI Pipeline)
-
Death messages added for all named creatures (RIP)
-
Death messages added for all named creatures
except players and tamed ones
(RIP)
### Fixed
-
Parse OpenAI JSON error messages, to display a more readable error message
...
...
src/main/java/com/owlmaddie/mixin/MixinLivingEntity.java
View file @
ccb3655c
...
...
@@ -7,6 +7,7 @@ import net.minecraft.entity.Entity;
import
net.minecraft.entity.LivingEntity
;
import
net.minecraft.entity.damage.DamageSource
;
import
net.minecraft.entity.mob.MobEntity
;
import
net.minecraft.entity.passive.TameableEntity
;
import
net.minecraft.entity.player.PlayerEntity
;
import
net.minecraft.item.ItemStack
;
import
net.minecraft.server.network.ServerPlayerEntity
;
...
...
@@ -70,6 +71,15 @@ public class MixinLivingEntity implements LivingEntityInterface {
World
world
=
entity
.
getWorld
();
if
(!
world
.
isClient
()
&&
entity
.
hasCustomName
())
{
// Skip tamed entities and players
if
(
entity
instanceof
TameableEntity
&&
((
TameableEntity
)
entity
).
isTamed
())
{
return
;
}
if
(
entity
instanceof
PlayerEntity
)
{
return
;
}
// Get the original death message
Text
deathMessage
=
entity
.
getDamageTracker
().
getDeathMessage
();
// Broadcast the death message to all players in the world
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment