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
b210e7c4
Commit
b210e7c4
authored
Jan 05, 2025
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chat messages are now displayed in chat bubbles above players heads
parent
6b8ee14d
Pipeline
#13273
passed with stages
in 2 minutes 14 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
MixinOnChat.java
src/main/java/com/owlmaddie/mixin/MixinOnChat.java
+37
-0
creaturechat.mixins.json
src/main/resources/creaturechat.mixins.json
+2
-1
No files found.
CHANGELOG.md
View file @
b210e7c4
...
...
@@ -10,6 +10,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
-
Player Icons (custom art embedded in player skin)
-
New Step-by-Step
**Icon**
Tutorial:
[
ICON.md
](
ICONS.md
)
-
New mixin to extend PlayerSkinTexture to make a copy of the NativeImage + pixel toggle to enable
-
Chat messages are now displayed in chat bubbles above players heads
-
Improved LLM Unit tests (to prevent rate limit issues from certain providers when running all tests)
-
Check friendship direction (+ or -) in LLM unit tests (to verify friendship direction is output correctly)
...
...
src/main/java/com/owlmaddie/mixin/MixinOnChat.java
0 → 100644
View file @
b210e7c4
package
com
.
owlmaddie
.
mixin
;
import
com.owlmaddie.chat.EntityChatData
;
import
net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket
;
import
net.minecraft.server.network.ServerPlayNetworkHandler
;
import
net.minecraft.server.network.ServerPlayerEntity
;
import
org.spongepowered.asm.mixin.Mixin
;
import
org.spongepowered.asm.mixin.injection.At
;
import
org.spongepowered.asm.mixin.injection.Inject
;
import
org.spongepowered.asm.mixin.injection.callback.CallbackInfo
;
import
static
com
.
owlmaddie
.
network
.
ServerPackets
.
BroadcastPlayerMessage
;
/**
* The {@code MixinOnChat} mixin class intercepts chat messages from players, and broadcasts them as chat bubbles
*/
@Mixin
(
ServerPlayNetworkHandler
.
class
)
public
abstract
class
MixinOnChat
{
@Inject
(
method
=
"onChatMessage"
,
at
=
@At
(
"HEAD"
),
cancellable
=
true
)
private
void
onChatMessage
(
ChatMessageC2SPacket
packet
,
CallbackInfo
ci
)
{
// Get the player who sent the message
ServerPlayNetworkHandler
handler
=
(
ServerPlayNetworkHandler
)
(
Object
)
this
;
ServerPlayerEntity
player
=
handler
.
player
;
// Get the chat message
String
chatMessage
=
packet
.
chatMessage
();
// Example: Call your broadcast function
EntityChatData
chatData
=
new
EntityChatData
(
player
.
getUuidAsString
());
chatData
.
currentMessage
=
chatMessage
;
BroadcastPlayerMessage
(
chatData
,
player
);
// Optionally, cancel the event to prevent the default behavior
//ci.cancel();
}
}
src/main/resources/creaturechat.mixins.json
View file @
b210e7c4
...
...
@@ -7,7 +7,8 @@
"MixinMobEntityAccessor"
,
"MixinLivingEntity"
,
"MixinBucketable"
,
"MixinVillagerEntity"
"MixinVillagerEntity"
,
"MixinOnChat"
],
"injectors"
:
{
"defaultRequire"
:
1
...
...
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