pub enum Event {
Init,
Login,
Chat(ChatPacket),
Tick,
Packet(Arc<ClientboundGamePacket>),
AddPlayer(PlayerInfo),
RemovePlayer(PlayerInfo),
UpdatePlayer(PlayerInfo),
Death(Option<Arc<ClientboundPlayerCombatKillPacket>>),
}
Expand description
Something that happened in-game, such as a tick passing or chat message being sent.
Note: Events are sent before they’re processed, so for example game ticks happen at the beginning of a tick before anything has happened.
Variants§
Init
Happens right after the bot switches into the Game state, but before
it’s actually spawned. This can be useful for setting the client
information with Client::set_client_information
, so the packet
doesn’t have to be sent twice.
Login
The client is now in the world. Fired when we receive a login packet.
Chat(ChatPacket)
A chat message was sent in the game chat.
Tick
Happens 20 times per second, but only when the world is loaded.
Packet(Arc<ClientboundGamePacket>)
AddPlayer(PlayerInfo)
A player joined the game (or more specifically, was added to the tab list).
RemovePlayer(PlayerInfo)
A player left the game (or maybe is still in the game and was just removed from the tab list).
UpdatePlayer(PlayerInfo)
A player was updated in the tab list (gamemode, display name, or latency changed).
Death(Option<Arc<ClientboundPlayerCombatKillPacket>>)
The client player died in-game.