Search in sources :

Example 1 with PacketReceiveEvent

use of me.wallhacks.spark.event.player.PacketReceiveEvent in project Spark-Client by Spark-Client-Development.

the class MixinNetworkManager method channelRead0.

@Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true)
public void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, final CallbackInfo callbackInfo) {
    PacketReceiveEvent event = new PacketReceiveEvent(p_channelRead0_2_);
    Spark.eventBus.post(event);
    if (event.isCanceled()) {
        callbackInfo.cancel();
    }
}
Also used : PacketReceiveEvent(me.wallhacks.spark.event.player.PacketReceiveEvent) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

PacketReceiveEvent (me.wallhacks.spark.event.player.PacketReceiveEvent)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1