Migrate Carpet Mixin names to mojang mappings

This commit is contained in:
FX - PR0CESS committed 2022-01-28 16:47:18 -05:00
1 parent 2c3871b90e
commit a547677597
154 files changed
+422 -501

No files matched your search

@@ -0,0 +1,38 @@
package carpet.mixins;
import carpet.fakes.ClientConnectionInterface;
import carpet.logging.logHelpers.PacketCounter;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Connection.class)
public abstract class Connection_packetCounterMixin implements ClientConnectionInterface
{
// Add to the packet counter whenever a packet is received.
@Inject(method = "channelRead0", at = @At("HEAD"))
private void packetInCount(ChannelHandlerContext channelHandlerContext_1, Packet<?> packet_1, CallbackInfo ci)
{
PacketCounter.totalIn++;
}
// Add to the packet counter whenever a packet is sent.
@Inject(method = "sendPacket", at = @At("HEAD"))
private void packetOutCount(Packet<?> packet_1,
GenericFutureListener<? extends Future<? super Void>> genericFutureListener_1, CallbackInfo ci)
{
PacketCounter.totalOut++;
}
@Override
@Accessor //Compat with adventure-platform-fabric
public abstract void setChannel(Channel channel);
}