steel_core/world/game_event/
context.rs1use steel_utils::BlockStateId;
3
4use crate::entity::Entity;
5
6#[derive(Clone, Default)]
8pub struct GameEventContext<'a> {
9 source_entity: Option<&'a dyn Entity>,
11 affected_state: Option<BlockStateId>,
13}
14
15impl<'a> GameEventContext<'a> {
16 #[must_use]
18 pub fn new(
19 source_entity: Option<&'a dyn Entity>,
20 affected_state: Option<BlockStateId>,
21 ) -> Self {
22 Self {
23 source_entity,
24 affected_state,
25 }
26 }
27
28 #[must_use]
30 pub fn source_entity(&self) -> Option<&'a dyn Entity> {
31 self.source_entity
32 }
33
34 #[must_use]
36 pub const fn affected_state(&self) -> Option<BlockStateId> {
37 self.affected_state
38 }
39}