completed /log packets port
This commit is contained in:
1 parent
516d3bc6eb
commit
d54ad4ba59
2 files changed
+33
-1
No files matched your search
@@ -0,0 +1,31 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.logging.logHelpers.PacketCounter;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.util.concurrent.Future;
|
||||||
|
import io.netty.util.concurrent.GenericFutureListener;
|
||||||
|
import net.minecraft.network.ClientConnection;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
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(ClientConnection.class)
|
||||||
|
public abstract class ClientConnectionMixin
|
||||||
|
{
|
||||||
|
// Add to the packet counter whenever a packet is received.
|
||||||
|
@Inject(method = "method_10770", 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 = "sendImmediately", at = @At("HEAD"))
|
||||||
|
private void packetOutCount(Packet<?> packet_1,
|
||||||
|
GenericFutureListener<? extends Future<? super Void>> genericFutureListener_1, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
PacketCounter.totalOut++;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,8 @@
|
|||||||
"PlayerActionC2SPacketMixin",
|
"PlayerActionC2SPacketMixin",
|
||||||
"ServerPlayerEntityMixin",
|
"ServerPlayerEntityMixin",
|
||||||
"ServerChunkManagerMixin",
|
"ServerChunkManagerMixin",
|
||||||
"HopperBlockEntityMixin"
|
"HopperBlockEntityMixin",
|
||||||
|
"ClientConnectionMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"MinecraftClientMixin",
|
"MinecraftClientMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user