Last active
March 31, 2021 23:56
-
-
Save hohserg1/db19850b6aa0ef3926d3f4a9c26a858e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SubscribeEvent | |
def blacklistResearchCategory1(e: FMLNetworkEvent.ServerConnectionFromClientEvent): Unit = { //Adding custom handler at server side | |
e.getManager.channel.pipeline | |
.addLast(Main.modid + ":hook_packet_handler", new PacketHook) //Work | |
//using addFirst gives effect, but packets look as CPacketCustomPayload | |
} | |
class PacketHook extends ChannelInboundHandlerAdapter { | |
override def channelRead(ctx: ChannelHandlerContext, msg: Any): Unit = { | |
super.channelRead(ctx, msg) | |
println("channelRead", msg) //nope printed | |
msg match { | |
case packet: PacketStartTheoryToServer => //Packet from thaumcraft 6 | |
//do something | |
case _ => | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment