From fc537c7e93fc0c5bb61335230dd84e51c7ee48e3 Mon Sep 17 00:00:00 2001 From: Purdze Date: Sun, 25 Jan 2026 15:51:30 +0000 Subject: [PATCH] fix: initialize player abilities based on gamemode on first join (#1373) when a player first joins with creative or spectator mode, their abilities (flying, invulnerability, creative mode flag) were not being set, this caused blocks to not display properly and flying to be disabled until switching gamemodes now calls set_for_gamemode() during player::new() to match vanilla fixes #1367 --- pumpkin/src/entity/player.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pumpkin/src/entity/player.rs b/pumpkin/src/entity/player.rs index 61f73145e..b15235b2c 100644 --- a/pumpkin/src/entity/player.rs +++ b/pumpkin/src/entity/player.rs @@ -452,6 +452,10 @@ impl Player { PlayerScreenHandler::new(&inventory, None, 0).await, )); + // Initialize abilities based on gamemode (like vanilla's GameMode.setAbilities()) + let mut abilities = Abilities::default(); + abilities.set_for_gamemode(gamemode); + Self { living_entity, config: RwLock::new(config), @@ -471,7 +475,7 @@ impl Player { teleport_id_count: AtomicI32::new(0), mining: AtomicBool::new(false), mining_pos: Mutex::new(BlockPos::ZERO), - abilities: Mutex::new(Abilities::default()), + abilities: Mutex::new(abilities), gamemode: AtomicCell::new(gamemode), previous_gamemode: AtomicCell::new(None), // TODO: Send the CPlayerSpawnPosition packet when the client connects with proper values