macro_rules! packet {
(@jvm($jvmname:literal) $name:ident { $($fname:ident : $ftype:ty),* }) => { ... };
}
Expand description
Creates a Packet implementation easily.
eg )
packet! {
@jvm("io.github.dolphin2410.packets.EntitySpawnPacket")
EntitySpawnRustPacket {
entity_id: i32,
entity_name: String,
network_connection_id: u8
}
}
With the following code, Sonet will map all the packets named “io.github.dolphin2410.packets.EntitySpawnPacket” to the struct EntitySpawnRustPacket. For Jvm compatibility, the names will default to Java’s package-class names