Skip to content

Commit

Permalink
Fix ProtocolLib index oob on chat packets (#1101 #1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Dec 3, 2023
1 parent 5dcf7a9 commit 7c67acb
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket;
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;

@Mixin(ClientboundSystemChatPacket.class)
public class ClientboundSystemChatPacketMixin {
Expand All @@ -20,4 +23,15 @@ public class ClientboundSystemChatPacketMixin {
public void arclight$constructor(BaseComponent[] content, boolean overlay) {
arclight$constructor(ComponentSerializer.toString(content), overlay);
}

@Inject(method = "<init>(Lnet/minecraft/network/chat/Component;Z)V", at = @At("RETURN"))
private void arclight$init(Component content, boolean overlay, CallbackInfo ci) {
this.content = Component.Serializer.toJson(content);
}

private String content;

public String content() {
return content;
}
}

0 comments on commit 7c67acb

Please sign in to comment.