package Ġio . openc ubes . box lin Ċ Ċ import Ġkotlinx . serialization . Experimental Serialization Api Ċ import Ġkotlinx . serialization . decode From ByteArray Ċ import Ġkotlinx . serialization . encode To ByteArray Ċ import Ġkotlinx . serialization . protobuf . Proto Buf Ċ import Ġnet . minecraftforge . fml . network . Network Direction Ċ import Ġnet . minecraftforge . fml . network . Network Event Ċ import Ġnet . minecraftforge . fml . network . simple . Simple Channel Ċ import Ġjava . util .* Ċ import Ġjava . util . function . Supplier ĊĊ Ċ type alias ĠMessage Consumer < T > Ġ= Ġ( item : ĠT , Ġcontext Supplier : ĠSupplier < Network Event . Context >) Ġ-> ĠUnit Ċ Ċ @ Opt In ( Experimental Serialization Api :: class ) Ċ @ Suppress (" IN ACC ES SI BLE _ TYPE ") Ċ inline Ġfun Ġ< re ified ĠT > ĠSimple Channel . register Message ( ĊĠ Ġindex : ĠInt , ĊĠ Ġdirection : ĠNetwork Direction ? Ġ= Ġnull , ĊĠ Ġno inline Ġmessage Consumer : ĠMessage Consumer < T > Ċ ) Ġ{ ĊĠ Ġregister Message ( ĊĠĠĠ Ġindex , ĊĠĠĠ ĠT :: class . java , ĊĠĠĠ Ġ{ Ġdata , Ġbuf Ġ-> Ġbuf . write ByteArray ( Proto Buf . encode To ByteArray ( data )) Ġ}, ĊĠĠĠ Ġ{ Ġbuf Ġ-> ĠProto Buf . decode From ByteArray ( buf . read ByteArray ()) Ġ}, ĊĠĠĠ Ġmessage Consumer , ĊĠĠĠ ĠOptional . of Nullable ( direction ) ĊĠ Ġ) Ċ } Ċ Ċ inline Ġfun Ġ< re ified ĠT > ĠSimple Channel . register Message ( index : ĠInt , Ġno inline Ġmessage Consumer : ĠMessage Consumer < T >) Ġ= ĊĠ Ġregister Message ( index , Ġnull , Ġmessage Consumer ) Ċ