diff options
Diffstat (limited to 'azalea-core/src')
| -rw-r--r-- | azalea-core/src/game_type.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/azalea-core/src/game_type.rs b/azalea-core/src/game_type.rs index e1a3e19b..8a17ef49 100644 --- a/azalea-core/src/game_type.rs +++ b/azalea-core/src/game_type.rs @@ -82,6 +82,15 @@ impl GameMode { } } +impl GameMode { + /// Whether the player can't interact with blocks while in this game mode. + /// + /// (Returns true if you're in adventure or spectator.) + pub fn is_block_placing_restricted(&self) -> bool { + matches!(self, GameMode::Adventure | GameMode::Spectator) + } +} + impl McBufReadable for GameMode { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let id = u8::read_from(buf)?; |
