diff --git a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch
index d95409b48..3d3957436 100644
--- a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch
+++ b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch
@@ -30,7 +30,7 @@
public void func_147251_a(SChatPacket p_147251_1_) {
PacketThreadUtil.func_218797_a(p_147251_1_, this, this.field_147299_f);
- this.field_147299_f.field_71456_v.func_238450_a_(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c(), p_147251_1_.func_240810_e_());
-+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
++ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c(), p_147251_1_.func_240810_e_());
+ if (message == null) return;
+ this.field_147299_f.field_71456_v.func_238450_a_(p_147251_1_.func_192590_c(), message, p_147251_1_.func_240810_e_());
}
diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java
index d8c309ef4..b1ec8a592 100644
--- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java
+++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java
@@ -24,15 +24,27 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
-@net.minecraftforge.eventbus.api.Cancelable
-public class ClientChatReceivedEvent extends net.minecraftforge.eventbus.api.Event
+import javax.annotation.Nullable;
+import java.util.UUID;
+
+/**
+ * Fired on the client when a chat message is received.
+ * If this event is cancelled, the message is not displayed in the chat message window.
+ * Fired on {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
+ */
+@Cancelable
+public class ClientChatReceivedEvent extends Event
{
private ITextComponent message;
private final ChatType type;
- public ClientChatReceivedEvent(ChatType type, ITextComponent message)
+ @Nullable
+ private final UUID senderUUID;
+
+ public ClientChatReceivedEvent(ChatType type, ITextComponent message, @Nullable UUID senderUUID)
{
this.type = type;
- this.setMessage(message);
+ this.message = message;
+ this.senderUUID = senderUUID;
}
public ITextComponent getMessage()
@@ -49,4 +61,14 @@ public class ClientChatReceivedEvent extends net.minecraftforge.eventbus.api.Eve
{
return type;
}
+
+ /**
+ * The UUID of the player or entity that sent this message, or null if not known.
+ * This will be equal to {@link net.minecraft.util.Util#field_240973_b_} for system messages.
+ */
+ @Nullable
+ public UUID getSenderUUID()
+ {
+ return senderUUID;
+ }
}
diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java
index 1d3bf6333..70bf6b69d 100644
--- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java
+++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java
@@ -330,9 +330,9 @@ public class ForgeEventFactory
}
@Nullable
- public static ITextComponent onClientChat(ChatType type, ITextComponent message)
+ public static ITextComponent onClientChat(ChatType type, ITextComponent message, @Nullable UUID senderUUID)
{
- ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message);
+ ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message, senderUUID);
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
}