import minecraft.networking.packets from protocol import packets def get_packets(old_get_packets): def wrapper(func, context): print('Monkey-patch worked.') mc_packets = func(context) # add any custom packets here mc_packets.add(packets.ChunkDataPacket) mc_packets.add(packets.BlockChangePacket) mc_packets.add(packets.MultiBlockChangePacket) return mc_packets return lambda x: wrapper(old_get_packets, x) minecraft.networking.packets.clientbound.play.get_packets = get_packets(minecraft.networking.packets.clientbound.play.get_packets)