#Trying to mixin to ClientPacketListener
43 messages · Page 1 of 1 (latest)
That is for Minecraft and the packets the vanilla game listens to. If you are trying to send your own packets between the client and server, what you want to be looking at is ClientPlayNetworking and ServerPlayNetworking from FAPI. This allows you to register and listen to your own packets
i'm looking to intercept ClientboundSystemChatPacket s
and process them before the game does things with them
thx <3
Hmm, I can't find anything named ClientBoundSystemChatPacket. Is that the correct name for the class or are you using Mojmap for mappings?
I found in Mojmaps ClientboundSystemChatPacket
I guess that would be ChatMessageS2CPacket in yarn?
In yarn it's GameMessage
Ah, ok
GameMessageS2CPacket
My guess, and correct me if I am wrong Sky, would Fred want to mixin where this data is being set on the client (I don't remember what class it's done in)
ClientPlayNetworkHandler#onGameMessage, yarn mapping?
uhhhhh ill look
im using the mappings you can find on the mc wiki
are there seperate ones for fabric?
Probably would be better to do it in MessageHandler#onGameMessage because that is where the actual logic is taking place. And ClientPlayNetworkHandler#onGameMessage calls that, yarn mappings
Mojmap is provided by Mojang itself whereas Yarn is open source and maintained by Fabric https://github.com/FabricMC/yarn?tab=readme-ov-file#yarn
Honestly I have no idea
hey, sorry to bother again, but i've done all the troubleshooting and can confirm that's where I want to mixin. The issue that I get is that for some reason it tells me that the poackage doesnt exist error: package net.minecraft.client.network.message does not exist import net.minecraft.client.network.message.MessageHandler;
Can you post your mixin class?
import net.minecraft.client.network.message.MessageHandler;
import net.minecraft.text.Text;
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(MessageHandler.class)
public class PacketReaderMixin {
@Inject(method = "onGameMessage", at = @At("HEAD"))
private void init(Text message, boolean overlay, CallbackInfo ci) {
System.out.println("test");
}
}```
Hmm
Are you using split sources?
My guess would be no you are not because you are experiencing this error.
idk
Make sure you have this in your build.gradle:
loom {
splitEnvironmentSourceSets()
mods {
"your-modid" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}
And your code is in src/client/...?
pretty much 🙂
i failed the idiot proofing