Mixins Break Upon Updating to 1.21.4
Greetings, I keep encountering a problem when trying to upgrade a mod from Minecraft version 1.19.4 to 1.21.4. I switched the Java dependencies to Java 21 as required by 1.21.4 but the compiler spits errors such as:
warning: Unable to determine descriptor for @Inject target method
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
Some of the functions it can't seem to find are sendPacket
, onPlayerSpawn
, onDisconnect
, etc. and I verified they are all using the correct class and that the methods do, in fact, exist. Here is the beginning of one such function that has a Mixin injection:
@Mixin(ClientPlayNetworkHandler.class)
public class C2SPacketDelayMixinMain {
@Shadow private ClientConnection connection;
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
private void interceptSendPacket(Packet<?> packet, CallbackInfo callbackInfo) {
...
I also tried changing "sendPacket"
to "sendPacket(Lnet/minecraft/network/packet/Packet;)V"
but that only caused more errors. I am very rusty with Java and am not very familiar with Mixins or IntelliJ IDEA, but I use C a lot and thought I could read compiler warnings and figure out how to fix them lol. To my inexperienced eyes, this looks like a build system issue - maybe something isn't set up right? Please advise.